Scaling Microservices

Imagine you are part of a development and support team that is responsible for developing the company's flagship product—TaxCloud. TaxCloud helps taxpayers file their own taxes and charges them a small fee upon the successful filing of taxes. Consider you had developed this application using microservices. Now, say the product gets popular and gains traction, and suddenly, on the last day of tax filing, you get a rush of consumers wanting to use your product and file their taxes. However, the payment service of your system is slow, which has almost brought the system down, and all the new customers are moving to your competitor's product. This is a lost opportunity for your business.

Even though this is a fictitious scenario, it can very well happen to any business. In e-commerce, we have always experienced these kinds of things in real life, especially on special occasions such as Christmas and Black Friday. All in all, they point toward one major significant characteristic—the scalability of the system. Scalability is one of the most important non-functional requirements of any mission-critical system. Serving a couple of users with hundreds of transactions is not the same as serving millions of users with several million transactions. In this chapter, we will discuss scalability in general. We'll also discuss how to scale microservices individually, what to consider when we design them, and how to avoid cascading failure using different patterns. By the end of this chapter, you will have learned about: