There is an interesting tension between applications’ business logic and their scalability and on top of this tension consistency is the quality that is traded-off.
For a system to scale in a word-wide environment it is necessary at some point to partitioning the persistent data. That is the main idea behind the shared-nothing architecture and the microservices architecture. While the former partitions data into shards that are independent and self-sufficient, the initial role of partitions in the latter is to enforce modularity and support a product-centered view of software development by cross-functional teams. In both cases, the interaction between the nodes, in the shared-nothing architecture, and the interactions between microservices, in the microservices architecture, is non transactional, due to the cost of a two phase commit protocol, and the applications need to rely on a weaker consistency model.
Therefore, the well-established shared-data architectural style that is being used in enterprise applications needs to be rethought. According to this style the data accessors are independent among themselves, depending only on the data model supported by the repository. In order to reduce this dependence database technology has defined several layers of independence, in the relational context: physical, logical and conceptual. For instance, physical independence allows to change the indexing of data without changing the data models. However, the shared data model is being identified as a bottleneck in the software development, which lead to solutions based on microservices, like the Amazon’s experience.
To partition the data model it is also necessary to partition the application business logic. This is not an easy task because tightly interconnected data leads to tangled business logic. The domain driven design approach faces this problem by proposing the definition of several bounded contexts, within there is a uniform model with a transactional behavior, and context maps between them, where value objects are used to map bounded context’s concepts and non transactional behavior occurs in the interaction between bounded contexts.
Although the idea of partitioning persistent data is appealing, and currently highly fashionable, the cost of managing the non-transactional interactions between nodes should not be underestimated because the business logic will be biased by the partitioning structure resulting on non-obvious, and business meaningless, flows of control.