D5e
D5e

Scaling Microservices with Message Queues, Spring Boot and Koobernaytis

November 2019


Scaling Microservices with Message Queues, Spring Boot and Koobernaytis

When you design and build applications at scale, you deal with two significant challenges: scalability and robustness.

You should design your service so that even if it is subject to intermittent heavy loads, it continues to operate reliably.

Take the Apple Store as an example.

Every year millions of Apple customers preregister to buy a new iPhone.

That's millions of people all buying an item at the same time.

If you were to picture the Apple store's traffic as requests per second over time, this is what the graph could look like:

10:00 pm 08:00 pm 06:00 pm 05:00 pm 03:00 pm 01:00 pm 10k req/s 7k req/s 3k req/s

Now imagine you're tasked with the challenge of building such application.

You're building a store where users can buy their favourite items.

You build a microservice to render the web pages and serving the static assets.

You also build a backend REST API to process the incoming requests.

You want the two components to be separated because with the same REST API you could serve the website and mobile apps.

BACKEND REST API

Today turned out to be the big day, and your store goes live.

You decide to scale the application to four instances for the front-end and four instances for the backend because you predict the website to be busier than usual.

API LOAD BALANCER LOAD BALANCER User BACKEND BACKEND BACKEND BACKEND

You start receiving more and more traffic.

The front-end services are handling the traffic fine.

You notice that the backend that is connected to the database is struggling to keep up with the number of transactions.

No worries, you can scale the number of replicas to 8 for the backend.

LOAD BALANCER LOAD BALANCER User BACKEND BACKEND BACKEND BACKEND BACKEND BACKEND BACKEND BACKEND

You're receiving even more traffic, and the backend can't cope with it.

Some of the services start dropping connections.

Angry customers get in touch with your customer service.

And now you're drowning in traffic.

Your backend can't cope with it, and it drops plenty of connections.

LOAD BALANCER LOAD BALANCER User