Hazelcast data isolation ("Memory Regions")

676 views Asked by At

We are building a multi tenant application which has restrictions on the regions/countries where the data is persisted.

The application is based on microsoft .Net microservice architecture but we have shared Domains, although we have separate DBs at very lower levels say for each city a separate DB. We cannot persist the data of one country in another country's data center. Hazelcast will be used as the distributed cache. I could not find any direct ways to configure data isolation for ex. like "Memory Regions" in apache ignite. Do we have "Memory Regions" in hazelcast?

I need to write behind the data from cache to respective Database. Can I segregate a part/partition of cache specific to a database instance?

Any help would be greatly appreciated. Thanks in advance.

1

There are 1 answers

2
Saravanan On BEST ANSWER

I am not directly replying to your question. IMHO, from my understanding when you have a data stored across different clusters / nodes, there will still be a network call, despite you having some key formats so that the data is stored within the same Cluster / Node.

Based on my experience, you could easily setup a MemoryCache that comes as part of the System.Runtime.Caching to store the data in every node and then use Redis Pub-Sub or Azure Service bus as the back-bone for the pub-sub.

In that case,

  • any data that is updated in a cache is notified to all the other instances of the application via a ServiceBus / Redis message which is typically the key.

  • Upon receipt of the key, each application clears out its internal cache and then gets the data cached back on the next DB access.

This method is more commonly prevalent in Multi-Tenant Applications and also is fail-safe and light weight. The payloads / network transfers are less and each AppDomain has its internal memory used as a cache which does support different regions via different instances of MemoryCache.

Hope this helps if no direct response is available regarding HazelCast

Also, you may refer to this link for some details regarding the Hazelcast