Ehcache / Hibernate and RMI replication with large number of entities

让人想犯罪 __ 提交于 2019-12-04 03:41:23

We already have one hack where we have our own custom copy of the hibernate EhCacheProvider that overrides buildCache() to create our own Cache objects with shortened names (the hash of the name). This gets around the 1500 limit. We keep a hashmap of the original names with the hash names for reverse lookup.

We did this a while ago and have been using it in production.

We also looked at your other issue to have a single replicator thread. First we copied RMICacheReplicatorFactory and changed createCacheEventListener() to return our copy of RMIAsynchronousCacheReplicator that we modified by making the replicationThread field static and then making the necassary fixes for that. We didn't get around to testing it thoroughly or putting it in production, but are looking at it again which is how I found this post :)

Did you consider JBossCache as an alternative to EHcache? JBossCache has distributed transactions and is well-tested for high-loads. It has lower-level replication mechanisms which can allow you to use UDP or TCP multicasting/broadcasting replication.

Did you consider EHCache over Terracotta? Take a look at Terracotta Hibernate Integration and Terracotta EHCache Integration

Importantly the Terracotta distributed EHCache is coherent - all nodes have the same view of the cache. This is very important for one of the applications I worked with.

Take a look. It works like a charm for us.

/RS

By the way, the 1500 byte limit has been addressed for the Ehcache 1.7.1 release of ehcache-core. See EHC-424.

Is jms replication an option?

(I have been looking in to using it with async behavior, it works nice. Documentation was wrong so I had to check the source code to see the actual attributes needed to configure it properly. Good thing with jms is that if you have that infrastructure set up you don't have to configure any firewalls and so on to let it through.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!