10 Microservices
This chapter covers:
- The basics of microservices
- The backend for frontend pattern
- Using asyncio to handle microservice communication
- Using asyncio to handle failures and retries
Many web applications are structured as monoliths. What do we mean when we say a monolith? A monolith generally refers to a medium to large sized application containing multiple modules that is independently deployed and managed as one unit. While there is nothing inherently wrong with this model (monoliths are perfectly fine, and even preferable for a majority of web applications as they are generally simpler), it does have its drawbacks.
As an example, if you make a small change to a monolithic application, you need to deploy the entire application, even parts that may be unaffected by your change. For instance, a monolithic e-commerce application may have order management and product listing endpoints in one application, meaning a tweak to a product endpoint would require a redeploy of order management code. A microservice architecture can help with such pain points. We could create separate services for orders and products, then a change in one service wouldn’t affect the other.