Lesson 75 - Microservices Data Services

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

I had a real-life example of this when it wasn't feasible, in the context of the company I was working with, to use a single database per microservice.

We had legacy data in one database that many services and teams needed to access. Despite having new bounded contexts/microservices, some new applications still needed access to this old data in certain situations to process requests.

Therefore, we decided to use a data services pattern until the migration was completed.

thalisoncarlos
Автор

Done thanks
5:30
Data services are the idea of having one (single instance) application that has the purpose of talking to the DB. Micro services that want to read from DB do so through this data service. This allows for centralized caching in the data service (as opposed to each microservice caching its own data and dealing with consistency issues).
Disadvantages: more latency as opposed to connecting to the db directly from the micro services. Single point of failure (if the data service goes down, the other micro services can’t access the data). Scalability issues as the data service becomes the bottle neck (we don’t want to have more instance of the data service and scale it that way, because then we defeat the purpose of a data service - might as well let the micro services access the db directly at this point)

mostinho
Автор

Hi Mark, what are the other ways to solve the Connection Pool problem. The same database schema could be used by different Microservices and also a single Microservice will have a multiple instances running. So having the connection pool configuration in the Microservice itself will lead to unnecessary high number of connection pools which will not be optimal, so we'll have to externalize the configuration and and additional data service is one of the good solution to that problem with a limited number of max instances.The second option of externalizing could be to have such configuration in the environment variables, but this also will need orchestration layer.

vikramb
Автор

Hi Mark, I thought that in your previous lessons claimed that DB sharing by Micro Services is bad idea? Is Data Service anti-pattern? When is DS it useful?

gagyboki