How do microservices share data?
- How would you transfer data between microservices?
- How data is stored in microservices?
- How can 2 microservices share common models between each other?
- Is it a good idea for microservices to share a common database?
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
-
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago