educative.io

Question about eventual consistency in microservices

As far as I understand, it is possible to replicate only the database so that there are multiple instances of the database running in different locations. I hope I understood this correctly. I have a few questions:

  1. You wrote following : “With the eventual consistency data model, millions of users worldwide can update the tweet’s like counter concurrently without having to wait for the system to reach a consistent state across all nodes deployed globally”.I don’t understand how, from the technical point of view, data is shared (transfered) between databases, so at the end they all databases in cluster have same data (reach a consistent state)? Who’s resposibility is to do this job?
  2. If we are talking about microservice architecture, when we scale a microservice, does that mean that we bring up just one another node (application server), or does that means that we must bring up two nodes: one node where application code will execute and the other one for the database. I ask this because it was said in the previous lessons that it is a good practice for the microservice to have exactly one database under it. I uploaded picture to make my question more clear. Please check it.

Regards,
Nemanja


Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers

  1. Who’s resposibility is to do this job?

It’s the responsibility of the database to reach a consistent state across different cloud regions. So, for instance, if you are using MongoDB. It’s MongoDB’s job to reach a consistent state.

2. When we scale a microservice, does that mean that we bring up just one another node (application server), or does that means that we must bring up two nodes: one node where application code will execute and the other one for the database.

It depends on the traffic load on the component. If you need to horizontally scale a microservice, you will add more nodes to the cluster running that particular service. If you need to scale the database component, you will add more nodes to the cluster running the database.

1 Like