Anonymous Asked in Cars &Transportation · 2 weeks ago

How do microservices share data?

A basic principle of microservices is that each service manages its own data. Two services should not share a data store. Instead, each service is responsible for its own private data store, which other services cannot access directly.


How would you transfer data between microservices?

Using messaging to exchange lightweight data structures, often via a message broker that manages sessions and data queues. Via a shared data store, where the service might not communicate directly, but share a common source of information. Exchanging RESTful data, similar to the way they communicate with clients.

How data is stored in microservices?

A microservice stores its data in its own dedicated database. A microservice will often also cache data owned by other microservices for several reasons: To reduce coupling to other microservices. This makes the overall system more stable.

How can 2 microservices share common models between each other?

The whole point of microservices is that they can change and scale independently. Sharing those models will force those services to iterate together, and will enforce strong coupling (bad). To deal with shared domains in a microservice architecture, keep you binding to a minimum.

Is it a good idea for microservices to share a common database?

I've seen folks refer to this idea in part, trivially, as “each microservice should own and control its own database and no two services should share a database.” The idea is sound: don't share a single database across services because then you run into conflicts like competing read/write patterns, data-model conflicts ...

Related Questions

Relevance
Write us your question, the answer will be received in 24 hours