Monolith vs Microservices
- We have tried to install nopcommerce, architecture of this is as shown below which is a monolith application
- Monolith application typicall runs the whole applciation in a server and has a database (on different instance)
- Major ecommerce modules typicall are
- Product catalog
- Cart services
- User Management
- Order Management
- Payment Services
- Customer Services
- In monolith all the code will be in a single repository with a single technology (everything on same version)
- Advantages:
- Works good when we have fewer modules to manage
- Everything in a single code base and deployments are easrier
- Disadvantages:
- Becomes difficult managing huge traffics
- Complex deployments for simple changes
- Microservices is all about breaking down a large system into individually deployable smaller services which serve some functionality (functionally one activity)
- We can have microservice for
- identity service
- product catalog service
- order service
- cart services
- payment services
- Web store
- Ideally each microservice will have its own database. This gives a flexibility to choose a different technology for each service.
- Each microservice will have its own git repo.
- Each microservice is individually deployable
- Microservices will be communicating with each other.
- Advantages:
- individually deployable microservices help in minimizing downtimes
- each service can be scaled indivually
- Disdavantages:
- Difficult to manage deployments manually
- The best place to run a microservice is a container becuase of portability.
- But we need a way to manage the microservices in production
- Challenges
- containers going down
- scaling containers
- deploying new versions
Kuberentes (k8s)
- Kubernetes also known as K8s, is an open source system for automating deployment, scaling, and management of containerized applications.
- Container orchestration is what kubernetes does
- K8s supports
- scaling containers
- deployments with zero downtime
- volumes
- load balancers
- identities
