Monolithic vs Microservices
Containers are not required to build microservices, but they suit the style particularly well, and Docker's rise is closely tied to it.
Monolithic architecture — a single code base with multiple modules, divided by business or technical feature, with one build system producing one deployable binary.
| Monolithic pros | Monolithic cons |
|---|---|
| Simple to develop | Difficult to understand and modify at scale |
| Simple to deploy a single package | Tightly coupled |
| Easier to debug and trace errors | Entire application redeployed on each update |
| Simple to test | One bug can bring down everything |
| Scaling requires scaling the whole application, not the busy part | |
| A change in one module can affect another through the shared code base |
Microservices architecture — an application arranged as a collection of loosely coupled services, each responsible for a discrete task, developed, deployed, and maintained independently, communicating through simple APIs.
| Microservices pros | Microservices cons |
|---|---|
| Loosely coupled | Inter-service communication is complex; requests travel over APIs |
| Small code bases, easier to understand and modify | Integration testing is harder — dependent services must be deployed first |
| Each service deploys independently | Debugging spans many services, each with its own logs |
| Each service scales independently | Deployment needs coordination across services |
| Each service can use a different technology stack | Operational surface is much larger |