0

I'm in the process of evaluating GridGain and have read and re-read all the documentation I could find. While much of it is very thorough, you can tell that it's mostly written by the developers. It would be great if there were a reference book written by an outsider's perspective.

Anyway, I have five basic questions I'm hoping someone from GridGain can answer and clarify for me.

  1. It's my understanding that GridCacheQueue (and the other Distributed Data Structures) are built on top of the GridCache implementation. Does that mean that each element of the GridCacheQueue is really just a GridCacheElement of the GridCache map, or is each GridCacheQueue a GridCacheElement, or do I have this totally wrong?
  2. If I set a default TTL on the GridCache, will the elements of a GridCacheQueue expire in the TTL time, or does it only apply to GridCacheElements (which might be answered in #1 above)?
  3. Is there a way to make a GridCacheQueue expire after some period of time without having to remove it manually?
  4. If a cache is set-up to be backed-up onto other nodes and the cache is using off-heap memory and/or swap storage, is the off-heap memory and/or swap storage also replicated onto the back-up nodes?
  5. Is it possible to create a new cache dynamically, or can it only be created via configuration when the node is created?

Thanks for any insightful information!

-Colin

SDI
  • 1
  • 1

2 Answers2

0

After experimenting with a GridCache and a GridCacheQueue, here's what I've learned about my 5 questions:

  1. I don't know how the GridCacheQueue or its elements are attached to a GridCache, but I know that the elements of a GridCacheQueue DO NOT show up as GridCacheElements of the GridCache.
  2. If you set a TTL on a GridCache and add a GridCacheQueue to it, once the elements of the GridCache begin expiring, the GridCacheQueue becomes unusable and will cause a GridRuntimeException to be thrown.
  3. Yes, see #2 above. However, there doesn't seem to be a safe way to test if the queue is still in existence once the elements of the GridCache start to expire.
  4. Still have no information about this yet. Would REALLY like some feedback on that.
  5. That was a question I never should have asked. A GridCache can be created entirely in code and configured.
SDI
  • 1
  • 1
0

Let me first of all say that GridGain supports several queue configuration parameters:

  • Colocated vs. non-colocated. In colocated mode you can have many queues. Each queue will be assigned to some grid node and all the data in that queue will be cached on that grid node. This way, if you have many queues, each queue may be cached on a different node, but queues themselves should be evenly distributed across all nodes. Non-colocated mode, on the other hand is meant for larger queues, where data for the same queue is partitioned across multiple nodes.
  • Capacity - this parameter defines maximum queue capacity. When queue reaches this capacity it will automatically start evicting elements oldest elements.

Now, let me try to tackle some of these questions.

  1. I believe each element of GridCacheQuery is a separate element in cache, but implementation marks them as internal elements. That is why you don't see these elements when iterating through cache.
  2. TTL should not be used with elements in the queue (GridGain will be adding this feature soon). For now, you should limit the maximum size of the queue by specifying queue 'capacity' at creation time.
  3. I don't believe so, but I think this feature is being added. For now, you can try using org.gridgain.grid.schedule.GridScheduler to schedule a job that will delete a queue later.
  4. The answer is YES. Both, data in off-heap and swap spaces is backed up and replicated the same way as main on-heap cache data.
  5. A cache should be created in configuration, either from code or XML. However, GridGain has a cool notion of GridCacheProjection which allows to create various sub-caches (cache views) on the same cache. For example, if you store Person and Organization classes in the same cache, then you can use cache projection for type Person when working with Person class, and cache projection of type Organization when working with Organization class.
Dmitriy
  • 2,282
  • 1
  • 11
  • 7
  • Thanks for taking the time to reply with such detail. Your response was very helpful. – SDI Mar 23 '14 at 20:55