Hardly any application has no storage, and it is always very inviting to use it indiscriminately. However, improper use of storage can be a problem for any type of application, including microservices.
When we think of the use of a pattern such as shared data, we have to adopt some good practices, which are listed as follows:
- Databases are for storing data, not for business rules: Storing business rules in the database is a mistake, because it makes the application dependent on a structure, the implementation of caches, and hinders the process of data migration and distribution.
- Databases are for storing data, not to communicate events: Some development teams adopt the process of triggers with their own database resources or workers observing changes to the information stored. The problem is that these triggers are difficult to monitor and debug, and are also a way to get business rules for storage.
- Do not create entities with cyclic dependency: Without a doubt, this is one of...