Microservices is a way of building an application as a set of small, separate services, each doing one job and talking to the others over the network.
Teams can then change and scale parts of a system on their own, at the price of many more moving parts.
Monolith or microservices
A monolith is one application: one codebase shipped as one deployment, usually with one database. Everything runs in the same process, so the checkout code can call the user code directly.
A microservices design splits those parts into separate services. An online shop might have users, catalogue, orders and payments services. Each runs on its own, owns its own data and offers an API the others call, usually over HTTP or through a message queue. Types of APIs covers the common styles.
Placing an order
Say a customer buys a cat bed. The orders service takes the request, asks the catalogue service whether the bed is in stock, asks the payments service to take the money, then saves the order in its own database.
Now say the payments service is down. In this monolith, calling the payment module was an in-process function call, so the module could not go down independently of the process. The function could still fail, and any external payment provider could still be unavailable. Here the orders service has to choose: retry, queue the payment for later, or ask the customer to try again. This kind of partial failure is what makes microservices a distributed system.
Each service keeps its own database. Sharing one would tie them back together, since a table change for one could break another.
Why teams choose them
Each service deploys on its own, so the payments team can ship a fix without waiting for anyone. Each one scales on its own too: during a sale you can run ten copies of the catalogue service and one copy of the rest.
Separating processes can contain a crash. If the catalogue service falls over, customers may still be able to sign in and check their orders, provided those paths do not require it. Timeouts and other isolation measures help stop failures spreading through dependencies.
Wondering how this was made? How we make these