简体   繁体   中英

Data affinity using hibernate 2nd level cache with hazelcast

i'm using hazelcast as a distributed 2nd level cache integrated with Hibernate an JPA. The application is already working but i would like to have data-affinity in the cluster.

I researched in the hazelcast documentation and found a way of doing it with the distributed map but i'm working with the entity manager, right?

Am i confused about how hazelcast works? How can i get data-affinity?

Answered by the hazelcast team on their google group.

Current hibernate 2nd Level implementation does not have have any mechanisms to increase data-affinity. But with version 3.6, hibernate second level implementation will not use distributed locks on cache entries, but will use EntryProcessors which works on data locally instead of relying on distributed operations, therefore less data goes over the wire. But even 3.6 will not have configuration mechanisms for keeping related entities on the same node, hazelcast only implements hibernate SPI and Hibernate or JPA configs does not provide such tweak mechanisms. My only suggestion is to use hazelcast in local mode instead of distributed mode. In this mode, cache data is kept locally on the node. See : http://docs.hazelcast.org/docs/3.5/manual/html-single/hazelcast-documentation.html#regionfactory-options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM