We have N microservices where N can be greater that 10. These N microservices depend on a Master Microservice M. So improving latency in our system we replicate bounded context information in each microservice 1 - N. I want to know more about it from external point of view, are we on right track or there is another way to handle such communication between microservices.
To summarize, there are N microservices each of which depends on some shared context. To improve performance, each of the microservices cache a view of the context locally.
Whether replication is the correct approach depends on the specifics of the shared context. The benefits of local caching in a distributed system are loosely based to the following:
In my opinion, it is worth caching locally if:
In certain setups, network calls can be relatively fast and handling the possibility of a stale context and properly sizing local caches has its own set of issues. However, if N services need higher throughput or M is bottlenecked and the data is well suited to caching then local caching is a reasonable approach. Distributed caching services may be considered if there is a large amount of data to be cached or if you don't want to handle cache invalidations manually.