ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Goncharuk <alexey.goncha...@gmail.com>
Subject Re: Cache size Ignite 2.0?
Date Mon, 05 Jun 2017 20:11:56 GMT
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 Алексей Рябов <ryabov.a@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.
>
>
>

Mime
View raw message