Video in progress
What is a microservices architecture, and how is it different from a monolith?
In microservices the system is split into several small, separately deployable applications; each one owns its own part of the business and its own data. In a monolith everything is one application and usually sits in one database.
📖 Answer
A monolith is one jar, one process, one database. Orders, payments, users: it's all in one codebase, and the parts call each other with plain method calls.
In microservices, order-service, payment-service and user-service are separate applications. They talk to each other over the network: HTTP, gRPC or a message broker.
In practice the difference shows up in these ways:
- you can deploy each service separately: a small fix in payments doesn't mean releasing the whole system;
- you scale each one separately: if the catalog gets a lot of load, you add copies of just that;
- a network call replaces the method call, which is slower and can fail at any time.
Be sure to mention that last point in an interview. Microservices aren't free: monitoring, tracing, deploy pipelines and distributed data problems all show up at once.
Sign up to mark studied questions and save your progress.