You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Алексей Рябов <ry...@gmail.com> on 2017/05/30 14:00:21 UTC

Cache size Ignite 2.0?

Hello,

i am trying to get the offHeap size of my cache. This code:

try (Ignite ignite = Ignition.start()){
    CacheConfiguration<String, BinaryObject> cfg = new CacheConfiguration<>();
    cfg.setName("sample");
    cfg.setStatisticsEnabled(true);
    cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);

    IgniteCache<String, BinaryObject> cache =
ignite.getOrCreateCache(cfg).withKeepBinary();
    cache.clear();
    for (int i=0; i<100; i++) {
        BinaryObjectBuilder builder = ignite.binary().builder("sample");
        builder.setField("field1", i*1000);
        builder.setField("field2", i);
        cache.put(Integer.toString(i), builder.build());
    }
    System.out.println("statistics: " + cache.metrics().isStatisticsEnabled());
    System.out.println(cache.metrics().getOffHeapAllocatedSize());
} catch (Exception e) {
    e.printStackTrace();
}


works fine in Ignite version 1.9.0:

...

[16:57:39] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
statistics: true
11890
[16:57:39] Ignite node stopped OK [uptime=00:00:00:230]

...

but in 2.0.0 (i commented cout line
cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)) methon
getOffHeapAllocatedSize returns zero:

...

[16:59:13] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
statistics: true
0
[16:59:22] Ignite node stopped OK [uptime=00:00:08:965]

...

Is there anything special that I should do in 2.0.0 to get the size of my cache?


Thanks a lot,

Aleksey.

Re: Cache size Ignite 2.0?

Posted by Алексей Рябов <ry...@gmail.com>.
Hi Mikhail,

What do you mean? Calculate a size of each BinaryObject instance before
putting it i cache and sum all of them to get final result?
Should be sufficient for me, but is there any methid for this calculation?

Thanks.

2017-06-06 13:59 GMT+03:00 Mikhail Getmanov <mi...@getmanov.name>:

> Hello,
> This functionality does not work for a long time. This is a bad solution,
> but you can bypass the cache and calculate the size of the objects that you
> store.
>
>
> __________________
> *Best Regards*
> *Mikhail Getmanov*
>
>
>
> 06.06.2017, 14:15, "Алексей Рябов" <ry...@gmail.com>:
>
> HI Alexey,
> I did not build Ignite myself - i got binary 2.0 release. Here is the full
> output log:
>
> [10:12:26]    __________  ________________
> [10:12:26]   /  _/ ___/ |/ /  _/_  __/ __/
> [10:12:26]  _/ // (7 7    // /  / / / _/
> [10:12:26] /___/\___/_/|_/___/ /_/ /___/
> [10:12:26]
> [10:12:26] ver. 2.0.0#20170430-sha1:d4eef3c6
> [10:12:26] 2017 Copyright(C) Apache Software Foundation
> [10:12:26]
> [10:12:26] Ignite documentation: http://ignite.apache.org
> [10:12:26]
> [10:12:26] Quiet mode.
> [10:12:26]   ^-- Logging to file 'C:\bigdata\apache-ignite-
> fabric-2.0.0-bin\work\log\ignite-cf1c6ec9.0.log'
> [10:12:26]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false
> or "-v" to ignite.{sh|bat}
> [10:12:26]
> [10:12:26] OS: Windows 7 6.1 amd64
> [10:12:26] VM information: Java(TM) SE Runtime Environment 1.8.0_101-b13
> Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.101-b13
> [10:12:26] Initial heap size is 254MB (should be no less than 512MB, use
> -Xms512m -Xmx512m).
> [10:12:26] Configured plugins:
> [10:12:26]   ^-- None
> [10:12:26]
> [10:12:26] Message queue limit is set to 0 which may lead to potential
> OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due
> to message queues growth on sender and receiver sides.
> [10:12:26] Security status [authentication=off, tls/ssl=off]
> [10:12:28] Performance suggestions for grid  (fix if possible)
> [10:12:28] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
> [10:12:28]   ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM
> options)
> [10:12:28]   ^-- Specify JVM heap max size (add '-Xmx<size>[g|G|m|M|k|K]'
> to JVM options)
> [10:12:28]   ^-- Set max direct memory size if getting 'OOME: Direct
> buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM
> options)
> [10:12:28]   ^-- Disable processing of calls to System.gc() (add
> '-XX:+DisableExplicitGC' to JVM options)
> [10:12:28] Refer to this page for more performance suggestions:
> https://apacheignite.readme.io/docs/jvm-and-system-tuning
> [10:12:28]
> [10:12:28] To start Console Management & Monitoring run
> ignitevisorcmd.{sh|bat}
> [10:12:28]
> [10:12:28] Ignite node started OK (id=cf1c6ec9)
> [10:12:28] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8,
> heap=3.5GB]
> statistics: true
> 0
> [10:12:28] Ignite node stopped OK [uptime=00:00:00:166]
> Process finished with exit code 0
>
>
> 2017-06-05 23:11 GMT+03:00 Alexey Goncharuk <al...@gmail.com>:
>
> Alexey,
>
> There is no CacheMemoryMode in Ignite 2.0 anymore since it has been
> removed in favor of the new Ignite architecture. It seems that you've built
> Ignite from one of the intermediate states between 1.9 and 2.0.
>
> Can you try with the ignite-2.0 release?
>
> --AG
>
> 2017-05-30 17:00 GMT+03:00 Алексей Рябов <ry...@gmail.com>:
>
> Hello,
>
> i am trying to get the offHeap size of my cache. This code:
>
> try (Ignite ignite = Ignition.start()){
>     CacheConfiguration<String, BinaryObject> cfg = new CacheConfiguration<>();
>     cfg.setName("sample");
>     cfg.setStatisticsEnabled(true);
>     cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
>
>     IgniteCache<String, BinaryObject> cache = ignite.getOrCreateCache(cfg).withKeepBinary();
>     cache.clear();
>     for (int i=0; i<100; i++) {
>         BinaryObjectBuilder builder = ignite.binary().builder("sample");
>         builder.setField("field1", i*1000);
>         builder.setField("field2", i);
>         cache.put(Integer.toString(i), builder.build());
>     }
>     System.out.println("statistics: " + cache.metrics().isStatisticsEnabled());
>     System.out.println(cache.metrics().getOffHeapAllocatedSize());
> } catch (Exception e) {
>     e.printStackTrace();
> }
>
>
> works fine in Ignite version 1.9.0:
>
> ...
>
> [16:57:39] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
> statistics: true
> 11890
> [16:57:39] Ignite node stopped OK [uptime=00:00:00:230]
>
> ...
>
> but in 2.0.0 (i commented cout line cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)) methon getOffHeapAllocatedSize returns zero:
>
> ...
>
> [16:59:13] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
> statistics: true
> 0
> [16:59:22] Ignite node stopped OK [uptime=00:00:08:965]
>
> ...
>
> Is there anything special that I should do in 2.0.0 to get the size of my cache?
>
>
> Thanks a lot,
>
> Aleksey.
>
>
>
>
>

Re: Cache size Ignite 2.0?

Posted by Алексей Рябов <ry...@gmail.com>.
HI Alexey,
I did not build Ignite myself - i got binary 2.0 release. Here is the full
output log:

[10:12:26]    __________  ________________
> [10:12:26]   /  _/ ___/ |/ /  _/_  __/ __/
> [10:12:26]  _/ // (7 7    // /  / / / _/
> [10:12:26] /___/\___/_/|_/___/ /_/ /___/
> [10:12:26]
> [10:12:26] ver. 2.0.0#20170430-sha1:d4eef3c6
> [10:12:26] 2017 Copyright(C) Apache Software Foundation
> [10:12:26]
> [10:12:26] Ignite documentation: http://ignite.apache.org
> [10:12:26]
> [10:12:26] Quiet mode.
> [10:12:26]   ^-- Logging to file
> 'C:\bigdata\apache-ignite-fabric-2.0.0-bin\work\log\ignite-cf1c6ec9.0.log'
> [10:12:26]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false
> or "-v" to ignite.{sh|bat}
> [10:12:26]
> [10:12:26] OS: Windows 7 6.1 amd64
> [10:12:26] VM information: Java(TM) SE Runtime Environment 1.8.0_101-b13
> Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.101-b13
> [10:12:26] Initial heap size is 254MB (should be no less than 512MB, use
> -Xms512m -Xmx512m).
> [10:12:26] Configured plugins:
> [10:12:26]   ^-- None
> [10:12:26]
> [10:12:26] Message queue limit is set to 0 which may lead to potential
> OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due
> to message queues growth on sender and receiver sides.
> [10:12:26] Security status [authentication=off, tls/ssl=off]
> [10:12:28] Performance suggestions for grid  (fix if possible)
> [10:12:28] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
> [10:12:28]   ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM
> options)
> [10:12:28]   ^-- Specify JVM heap max size (add '-Xmx<size>[g|G|m|M|k|K]'
> to JVM options)
> [10:12:28]   ^-- Set max direct memory size if getting 'OOME: Direct
> buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM
> options)
> [10:12:28]   ^-- Disable processing of calls to System.gc() (add
> '-XX:+DisableExplicitGC' to JVM options)
> [10:12:28] Refer to this page for more performance suggestions:
> https://apacheignite.readme.io/docs/jvm-and-system-tuning
> [10:12:28]
> [10:12:28] To start Console Management & Monitoring run
> ignitevisorcmd.{sh|bat}
> [10:12:28]
> [10:12:28] Ignite node started OK (id=cf1c6ec9)
> [10:12:28] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8,
> heap=3.5GB]
> statistics: true
> 0
> [10:12:28] Ignite node stopped OK [uptime=00:00:00:166]
> Process finished with exit code 0


2017-06-05 23:11 GMT+03:00 Alexey Goncharuk <al...@gmail.com>:

> Alexey,
>
> There is no CacheMemoryMode in Ignite 2.0 anymore since it has been
> removed in favor of the new Ignite architecture. It seems that you've built
> Ignite from one of the intermediate states between 1.9 and 2.0.
>
> Can you try with the ignite-2.0 release?
>
> --AG
>
> 2017-05-30 17:00 GMT+03:00 Алексей Рябов <ry...@gmail.com>:
>
>> Hello,
>>
>> i am trying to get the offHeap size of my cache. This code:
>>
>> try (Ignite ignite = Ignition.start()){
>>     CacheConfiguration<String, BinaryObject> cfg = new CacheConfiguration<>();
>>     cfg.setName("sample");
>>     cfg.setStatisticsEnabled(true);
>>     cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
>>
>>     IgniteCache<String, BinaryObject> cache = ignite.getOrCreateCache(cfg).withKeepBinary();
>>     cache.clear();
>>     for (int i=0; i<100; i++) {
>>         BinaryObjectBuilder builder = ignite.binary().builder("sample");
>>         builder.setField("field1", i*1000);
>>         builder.setField("field2", i);
>>         cache.put(Integer.toString(i), builder.build());
>>     }
>>     System.out.println("statistics: " + cache.metrics().isStatisticsEnabled());
>>     System.out.println(cache.metrics().getOffHeapAllocatedSize());
>> } catch (Exception e) {
>>     e.printStackTrace();
>> }
>>
>>
>> works fine in Ignite version 1.9.0:
>>
>> ...
>>
>> [16:57:39] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
>> statistics: true
>> 11890
>> [16:57:39] Ignite node stopped OK [uptime=00:00:00:230]
>>
>> ...
>>
>> but in 2.0.0 (i commented cout line cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)) methon getOffHeapAllocatedSize returns zero:
>>
>> ...
>>
>> [16:59:13] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
>> statistics: true
>> 0
>> [16:59:22] Ignite node stopped OK [uptime=00:00:08:965]
>>
>> ...
>>
>> Is there anything special that I should do in 2.0.0 to get the size of my cache?
>>
>>
>> Thanks a lot,
>>
>> Aleksey.
>>
>>
>>
>

Re: Cache size Ignite 2.0?

Posted by Alexey Goncharuk <al...@gmail.com>.
Alexey,

There is no CacheMemoryMode in Ignite 2.0 anymore since it has been removed
in favor of the new Ignite architecture. It seems that you've built Ignite
from one of the intermediate states between 1.9 and 2.0.

Can you try with the ignite-2.0 release?

--AG

2017-05-30 17:00 GMT+03:00 Алексей Рябов <ry...@gmail.com>:

> Hello,
>
> i am trying to get the offHeap size of my cache. This code:
>
> try (Ignite ignite = Ignition.start()){
>     CacheConfiguration<String, BinaryObject> cfg = new CacheConfiguration<>();
>     cfg.setName("sample");
>     cfg.setStatisticsEnabled(true);
>     cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
>
>     IgniteCache<String, BinaryObject> cache = ignite.getOrCreateCache(cfg).withKeepBinary();
>     cache.clear();
>     for (int i=0; i<100; i++) {
>         BinaryObjectBuilder builder = ignite.binary().builder("sample");
>         builder.setField("field1", i*1000);
>         builder.setField("field2", i);
>         cache.put(Integer.toString(i), builder.build());
>     }
>     System.out.println("statistics: " + cache.metrics().isStatisticsEnabled());
>     System.out.println(cache.metrics().getOffHeapAllocatedSize());
> } catch (Exception e) {
>     e.printStackTrace();
> }
>
>
> works fine in Ignite version 1.9.0:
>
> ...
>
> [16:57:39] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
> statistics: true
> 11890
> [16:57:39] Ignite node stopped OK [uptime=00:00:00:230]
>
> ...
>
> but in 2.0.0 (i commented cout line cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)) methon getOffHeapAllocatedSize returns zero:
>
> ...
>
> [16:59:13] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
> statistics: true
> 0
> [16:59:22] Ignite node stopped OK [uptime=00:00:08:965]
>
> ...
>
> Is there anything special that I should do in 2.0.0 to get the size of my cache?
>
>
> Thanks a lot,
>
> Aleksey.
>
>
>