-
1. Re: Do AtomicMap's support Query?
sannegrinovero Feb 14, 2012 6:38 PM (in response to ggear)Hi,
indeed that's currently not supported, but I could work on it.
How would you expect the query to look like? We have two levels of keys in this case, the key identifying the AtomicMap and the key identifying the entry in the AtomicMap.
One approach would be to consider all entries of the same AtomicMap as part of the same entry - so you would search for an AtomicMap and retrive the full map as a result; another approach would be to be able to search for the specific entry as contained in the AtomicMap.
A third approach would be that AtomicMaps are ignored by the indexing layer, so no errors thrown but also no query options.
I think I would implement the first model but would appreciate hearing back from you about what expectations you would have, and what your use case is.
-
2. Re: Do AtomicMap's support Query?
ggear Feb 15, 2012 6:27 PM (in response to sannegrinovero)Thanks Sanne.
I could see value in implementing all 3 senarios you oultine, but I was specifically looking for the 2nd instance, ie
search for the specific entry as contained in the AtomicMap
I have only just started looking at how to structure queries, perhaps I need to revisit my cache architecture. To date I had latched onto AtomicMaps and have been using them to namespace my keys for different typed values, perhaps I need to build composite keys with type prefixes or maybe use multilpe cache instances. More research required.
Graham
-
3. Re: Do AtomicMap's support Query?
sannegrinovero Feb 16, 2012 7:18 AM (in response to ggear)Hi Graham,
you might also want to explore the option of storing entries directly in the cache, and have multiple caches.
It's not advisable to have too many caches, but a cache is likely more efficient than an AtomicMap - so it depends on how many namespaces you're expecting.
Another option is to create your custom key object; it's very common to implement a key as something like
class Key {
final String namespace;
final long id;
// constructor
// equals
// hashcode
}
That pretty much provides you complete isolation across namespaces in the same cache, and is easy to use for indexing.
-
4. Re: Do AtomicMap's support Query?
nikolay1981 Feb 23, 2012 6:36 PM (in response to sannegrinovero)Sanne,
Is it good solution to have 1 cache per domain object like in a case of using oracle coherence? Theoretically it should improve perfomance in terms of to iteration over cache or running jobs against cache.
Is there any potential impact on transactions and replication? I have transactions with a few domain objects involved.
Thank you.
-
5. Re: Do AtomicMap's support Query?
sannegrinovero Feb 24, 2012 10:08 AM (in response to nikolay1981)Nikolay, is this a general question or is it in the context of queries ?
For Queries it should not be a significant difference to have indexed domain objects in separate caches, but you're correct for the scope of the Infinispan container this might reduce contention on the internal container structures. Carefull however as having too many caches might also not scale, they take quite some memory: don't create thousands of caches.
Both transactions and replications should work the same, no matter if you store objects in the same cache or in different caches.
-
6. Re: Do AtomicMap's support Query?
nikolay1981 Feb 24, 2012 4:10 PM (in response to sannegrinovero)Yes. This was a general question. I'm going to have a few business objects residing in separate caches. Let say User, Address, Company and correspondent caches UserCache, AddressCache, CompanyCache. As few business objects of different types might be involved into a transaction I want to make sure that all caches will be consistent and transaction will be propagated to recovery site node in a proper way.
Thank you for your reply.