Dark matter force: efficient interactions
When designing a microservice architecture, we need to ensure that the components that implement a distributed system operation communicate efficiently. The desire for efficient interactions acts as an attractive force between the operation’s subdomains.
Local operations have minimal communication overhead
A local operation has no communication overhead and, perhaps, all data access is handled by the service’s database. As a result, from a communications perspective, a local operation is efficient.
A distributed implementation of an operation is potentially inefficient
A distributed system operation’s efficiency is proportional to the number of messages that are exchanged between the services that implement it and the size of those messages. A distributed operation might require large datasets to be transported over the network and joined together in memory. That’s potentially inefficient because it consumes CPU resources to repeatedly serialize and deserialize the data and network resources to transport the data between databases and services. Moreover, the operation might have high latency if involves numerous round trips between services. As a result, the requirement for an operation to be efficient might require some of its subdomains to be packaged together.