Help - preload cache seems hanging
lmcjroh Aug 16, 2011 4:44 PMHi,
I am new to Infinispan. I am evaluating Infinispan by applying existing product if we can gain performance improvement.
Currently, I am using glassfish application server and use toplink essential as JPA.
I don't want to use infinispan as Hibernate L2 cache.
To reduce development time, I use existing entity class by removing all JPA annotation as POJO to be stored in cache.
For search (or query) cache, I am using Hibernate Search and Apache Lucene.
I will test with replication mode and distributed mode.
For now, I am doing replication mode first.
Here are my concerns because I am not sure if I am going to right direction or not:
1) What to put into Cache
I have a subscriber and each subscriber has a list of users.
I created 2 caches; one for subscriber and the other for user.
@Indexed
@ProvidedId
public class Subscriber implements Serializable {
@Field
private String id;
...
@ContainedIn
private Collection<User> users;
}
@Indexed
@ProvidedId
public class User implements Serializable {
@Field
private String id;
@IndexedEmbedded(depth=1)
private Subscriber subscriber;
}
I create subscriberCache to put id as key and subscriber object as value which contains list of users.
I create userCache to put id as key and user object as value.
Question: I don't know if this is good way or not. Each cache has copy of other objects in other cache.
Only benefit is that if I need to search subscriber by user name, then I can just search subscriber cache.
I don't think that cache has notion about join.
Altenative, I can store list of user ids instead of list of user objects in Subscriber class and subscriber id instead of Subscriber object in User class.
Then, I need to search user cache to get subscriber id by user name and then search subscriber cache by subscriber id.
This is ok for replicated cache but I am concerning about distributed cache.
2) InfinispanDirectory
I am confusing about infinispan directory.
I have 2 caches already and I want to save indexes into persistent storage.
When I use "infinispan" as hibernate.search.default.directory_provider and setting preload=true in cacheloader, when I call DefaultCacheManager.getCache(subscriber), application hangs.
I don't find good document or example how to use infinispan as directory provider.
In infinispan document, https://docs.jboss.org/author/display/ISPN/Infinispan+as+a+Directory+for+Lucene, it just shows to create constructor.
new InfinispanDirectory(cache, "indexName")
Is this directory a file system or do I need to create cache for index and use cache store/loader?
Thanks.
-
test-cache.xml 5.0 KB