Offheap and max memory

classic Classic list List threaded Threaded
4 messages Options
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Offheap and max memory

Hi

I am using Partitioned, Atomic, OffHeap cache, creating cache pragmatically.

Recently noticed offHeapMaxMemory is not set because of glitch in my configuration and program. Based on java doc default offHeapMaxMemory value is -1, specified by DFLT_OFFHEAP_MEMORY constant which means that off-heap storage is disabled by default.

I was not facing any issues for put, get and etc operation, so wondering where does data gets cached? OffHeap/OnHeap.

       try (Ignite ignite = Ignition.start("config/example-ignite.xml")) {
            CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
            cacheCfg.setName(CACHE_NAME);
            cacheCfg.setCacheMode(CacheMode.PARTITIONED);
            cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
            cacheCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);

            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cacheCfg)) {
                putGet(cache);
                putAllGetAll(cache);
            } finally {
                ignite.destroyCache(CACHE_NAME);
            }
     }


Thanks,
-Sam
Vyacheslav Daradur Vyacheslav Daradur
Reply | Threaded
Open this post in threaded view
|

Re: Offheap and max memory

Hi, 

I've looked at sources.

If memMode == OFFHEAP_TIERED, but offHeapMaxMemory < 0 
then offHeapMaxMemory will be setted to unlimited '0'.

Try to debug after starting a cache, and look at IgniteCache#getConfiguration(CacheConfiguration.class) and getOffHeapMaxMemory, it must be '0'

2017-04-26 21:16 GMT+03:00 [hidden email] <[hidden email]>:
Hi

I am using Partitioned, Atomic, OffHeap cache, creating cache pragmatically.

Recently noticed offHeapMaxMemory is not set because of glitch in my
configuration and program. Based on java doc default offHeapMaxMemory value
is -1, specified by DFLT_OFFHEAP_MEMORY constant which means that off-heap
storage is disabled by default.

I was not facing any issues for put, get and etc operation, so wondering
where does data gets cached? OffHeap/OnHeap.

/       try (Ignite ignite = Ignition.start("config/example-ignite.xml")) {
            CacheConfiguration<Integer, String> cacheCfg = new
CacheConfiguration<>();
            cacheCfg.setName(CACHE_NAME);
            cacheCfg.setCacheMode(CacheMode.PARTITIONED);
            cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
            cacheCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);

            try (IgniteCache<Integer, String> cache =
ignite.getOrCreateCache(cacheCfg)) {
                putGet(cache);
                putAllGetAll(cache);
            } finally {
                ignite.destroyCache(CACHE_NAME);
            }
     }/

Thanks,
-Sam



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Offheap-and-max-memory-tp12275.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--
Best Regards, Vyacheslav
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Offheap and max memory

It looks like documentation is misleading.

Tried test program -

- without setting offHeapMaxMemory, getOffHeapMaxMemory returns 0.
- Setting offHeapMaxMemory=-1, getOffHeapMaxMemory returns 0.

Thanks,
-Sam
Vyacheslav Daradur Vyacheslav Daradur
Reply | Threaded
Open this post in threaded view
|

Re: Offheap and max memory

It looks like documentation is misleading.
I partially agree.

CacheConfiguration is validated during creation of a cache (when you call a ignite.getOrCreateCache
and some mismatches like OFFHEAP mode with offHeapMaxMemory equlas -1 will be resolved.

Maybe it makes sense to add explanation to 'offHeapMaxMemory' field in Ignite 1.9.
As far as I know Ignite-2.0 is moving to full-off-heap page memory model, and CacheConfiguration will be remade, including the removal of  'offHeapMaxMemory' field.



2017-04-27 2:39 GMT+03:00 [hidden email] <[hidden email]>:
It looks like documentation is misleading.

Tried test program -

- without setting offHeapMaxMemory, getOffHeapMaxMemory returns 0.
- Setting offHeapMaxMemory=-1, getOffHeapMaxMemory returns 0.

Thanks,
-Sam




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Offheap-and-max-memory-tp12275p12277.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--
Best Regards, Vyacheslav