What is the difference between a monolithic and microservices architecture?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex System Design topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
Monolithic architecture: all application components (UI, business logic, data access) are in a single codebase, compiled and deployed together as one unit. Pros: simple development and debugging (single codebase), easy local development, simple deployment (one artifact), no network latency between components, simpler transactions (ACID). Cons: as it grows — hard to understand and modify, long build/deploy times, must deploy the whole app for a small change, one bug can crash everything, can't scale individual components (must scale the whole app), technology lock-in. Microservices architecture: application split into small, independent services each with its own codebase, data store, and deployment pipeline. Pros: independent deployment and scaling, technology flexibility per service, fault isolation (one service crash doesn't crash others), smaller codebases easier to understand, team autonomy. Cons: distributed system complexity, network latency between services, distributed transactions (no easy ACID), service discovery, operational overhead (many services to monitor), testing complexity. Migration path: start with a monolith (simpler, faster iteration early on); identify natural boundaries (domain-driven design); extract services as specific components need independent scaling, different technologies, or independent deployment. Strangler fig pattern: gradually migrate monolith to microservices by building the new service alongside the old, routing traffic incrementally.
Pro Tip
Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a System Design codebase.
Previous
What is a content delivery network (CDN) and how does it reduce latency?
Next
What is service discovery?