How to Share Data Between Services: Best Practices and Pitfalls

TLDRLearn how to share data between services effectively, including when and when not to do it. Discover best practices for data ownership and examples of reference data sharing. Avoid common pitfalls and ensure smooth communication between service boundaries.

Key insights

💡Each service should own its own data, ensuring data ownership and clear boundaries.

🔄Avoid synchronous request-response communication between services; use asynchronous event-driven communication for non-volatile reference data.

🔒Persist non-volatile reference data locally to prevent availability concerns and reduce dependencies on external services.

💱Examples of reference data sharing include currency exchange rates and credit scores, where data volatility and shelf life play a role.

🚫Do not share transactional data between services; each service should manage its own transactional data.

Q&A

When should you share data between services?

You should share data between services when it is non-volatile reference data, such as currency exchange rates or credit scores.

What communication patterns should you use to share data between services?

For non-volatile reference data, use asynchronous event-driven communication to reduce dependencies and ensure smooth communication between service boundaries.

Why is data ownership important?

Data ownership ensures clear boundaries between services and avoids dependencies and availability concerns when sharing data.

Can you share transactional data between services?

No, each service should manage its own transactional data to maintain data integrity and autonomy.

What are examples of reference data sharing?

Examples include currency exchange rates and credit scores, where the volatility and shelf life of the data play a role.

Timestamped Summary

00:00Data sharing between services is a common challenge in systems with multiple services.

02:56Sharing data between services should be done based on clear data ownership and boundaries.

05:19Non-volatile reference data, like currency exchange rates, can be persisted locally to reduce dependencies on external services.

08:13Asynchronous event-driven communication is recommended for sharing non-volatile reference data.

09:33Examples of reference data sharing include currency exchange rates and credit scores.