Cache Metrics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cache Metrics

Alper Tekinalp
Hi all.

I have the following code:
        IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
        igniteConfiguration.setGridName("alper");
        Ignite start = Ignition.start(igniteConfiguration);

        CacheConfiguration configuration = new CacheConfiguration();
        configuration.setAtomicityMode(CacheAtomicityMode.ATOMIC)
                .setCacheMode(CacheMode.PARTITIONED)
                .setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)
                .setRebalanceMode(CacheRebalanceMode.SYNC)

.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
                .setRebalanceThrottle(100)
                .setRebalanceBatchSize(2*1024*1024)
                .setBackups(1)
                .setName("cemil")
                .setEagerTtl(false);
        start.getOrCreateCache(configuration);

        IgniteCache<Object, Object> cemil = start.getOrCreateCache("cemil");

        cemil.put("1", "10");
        cemil.put("2", "10");
        cemil.put("3", "10");
        cemil.put("4", "10");

        System.out.println(cemil.metrics().getOffHeapAllocatedSize());
        System.out.println(cemil.metrics().getOffHeapBackupEntriesCount());
        System.out.println(cemil.metrics().getOffHeapGets());
        System.out.println(cemil.metrics().getOffHeapHits());
        System.out.println(cemil.metrics().getOffHeapMisses());
        System.out.println(cemil.metrics().getOffHeapPuts());
        System.out.println(cemil.metrics().getOffHeapEvictions());
        System.out.println(cemil.metrics().getOffHeapHitPercentage());

All prints 0. Is that normal? Am i doing something wrong?

--
Alper Tekinalp

Software Developer
Evam Streaming Analytics

Atatürk Mah. Turgut Özal Bulv.
Gardenya 5 Plaza K:6 Ataşehir
34758 İSTANBUL

Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
www.evam.com.tr
<http://www.evam.com>
Reply | Threaded
Open this post in threaded view
|

Re: Cache Metrics

Alexey Kuznetsov
Hi, Alper!

Could you try to set configuration.setStatisticsEnabled(true)  and try once
again?

On Tue, Dec 20, 2016 at 3:41 PM, Alper Tekinalp <[hidden email]> wrote:

> Hi all.
>
> I have the following code:
>         IgniteConfiguration igniteConfiguration = new
> IgniteConfiguration();
>         igniteConfiguration.setGridName("alper");
>         Ignite start = Ignition.start(igniteConfiguration);
>
>         CacheConfiguration configuration = new CacheConfiguration();
>         configuration.setAtomicityMode(CacheAtomicityMode.ATOMIC)
>                 .setCacheMode(CacheMode.PARTITIONED)
>                 .setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)
>                 .setRebalanceMode(CacheRebalanceMode.SYNC)
>
> .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
>                 .setRebalanceThrottle(100)
>                 .setRebalanceBatchSize(2*1024*1024)
>                 .setBackups(1)
>                 .setName("cemil")
>                 .setEagerTtl(false);
>         start.getOrCreateCache(configuration);
>
>         IgniteCache<Object, Object> cemil = start.getOrCreateCache("cemil"
> );
>
>         cemil.put("1", "10");
>         cemil.put("2", "10");
>         cemil.put("3", "10");
>         cemil.put("4", "10");
>
>         System.out.println(cemil.metrics().getOffHeapAllocatedSize());
>         System.out.println(cemil.metrics().getOffHeapBackupEntriesCount()
> );
>         System.out.println(cemil.metrics().getOffHeapGets());
>         System.out.println(cemil.metrics().getOffHeapHits());
>         System.out.println(cemil.metrics().getOffHeapMisses());
>         System.out.println(cemil.metrics().getOffHeapPuts());
>         System.out.println(cemil.metrics().getOffHeapEvictions());
>         System.out.println(cemil.metrics().getOffHeapHitPercentage());
>
> All prints 0. Is that normal? Am i doing something wrong?
>
> --
> Alper Tekinalp
>
> Software Developer
> Evam Streaming Analytics
>
> Atatürk Mah. Turgut Özal Bulv.
> Gardenya 5 Plaza K:6 Ataşehir
> 34758 İSTANBUL
>
> Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
> www.evam.com.tr
> <http://www.evam.com>
>



--
Alexey Kuznetsov
Reply | Threaded
Open this post in threaded view
|

Fwd: Cache Metrics

dsetrakyan
In reply to this post by Alper Tekinalp
Cross sending this to dev.

Igniters, why does the metrics stuff have to be so confusing? Looks like if
"statisticsEnabled" is false, then metrics return all 0s. Can we at least
have a warning in the log stating that the metrics are disabled, and
explaining how to enable them?

D.

---------- Forwarded message ----------
From: Alper Tekinalp <[hidden email]>
Date: Tue, Dec 20, 2016 at 3:10 AM
Subject: Re: Cache Metrics
To: [hidden email]


Hi all.

Thanks for your replies. Enabling statistics fixed it.

On Tue, Dec 20, 2016 at 12:39 PM, Andrey Mashenkov <[hidden email]>
wrote:

> Hi Alper,
>
> May be it is not obvious, but to enable offheap you need to
> setOffheapMaxMemory to zero (unlimited) or above zero.
> Also metrics is disabled by default, you need call
> setStatisticsEnabled(true);
>
> On Tue, Dec 20, 2016 at 11:41 AM, Alper Tekinalp <[hidden email]> wrote:
>
>> Hi all.
>>
>> I have the following code:
>>         IgniteConfiguration igniteConfiguration = new
>> IgniteConfiguration();
>>         igniteConfiguration.setGridName("alper");
>>         Ignite start = Ignition.start(igniteConfiguration);
>>
>>         CacheConfiguration configuration = new CacheConfiguration();
>>         configuration.setAtomicityMode(CacheAtomicityMode.ATOMIC)
>>                 .setCacheMode(CacheMode.PARTITIONED)
>>                 .setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)
>>                 .setRebalanceMode(CacheRebalanceMode.SYNC)
>>                 .setWriteSynchronizationMode(C
>> acheWriteSynchronizationMode.FULL_SYNC)
>>                 .setRebalanceThrottle(100)
>>                 .setRebalanceBatchSize(2*1024*1024)
>>                 .setBackups(1)
>>                 .setName("cemil")
>>                 .setEagerTtl(false);
>>         start.getOrCreateCache(configuration);
>>
>>         IgniteCache<Object, Object> cemil = start.getOrCreateCache("cemil"
>> );
>>
>>         cemil.put("1", "10");
>>         cemil.put("2", "10");
>>         cemil.put("3", "10");
>>         cemil.put("4", "10");
>>
>>         System.out.println(cemil.metrics().getOffHeapAllocatedSize());
>>         System.out.println(cemil.metrics().getOffHeapBackupEntriesCo
>> unt());
>>         System.out.println(cemil.metrics().getOffHeapGets());
>>         System.out.println(cemil.metrics().getOffHeapHits());
>>         System.out.println(cemil.metrics().getOffHeapMisses());
>>         System.out.println(cemil.metrics().getOffHeapPuts());
>>         System.out.println(cemil.metrics().getOffHeapEvictions());
>>         System.out.println(cemil.metrics().getOffHeapHitPercentage());
>>
>> All prints 0. Is that normal? Am i doing something wrong?
>>
>> --
>> Alper Tekinalp
>>
>> Software Developer
>> Evam Streaming Analytics
>>
>> Atatürk Mah. Turgut Özal Bulv.
>> Gardenya 5 Plaza K:6 Ataşehir
>> 34758 İSTANBUL
>>
>> Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
>> www.evam.com.tr
>> <http://www.evam.com>
>>
>
>


--
Alper Tekinalp

Software Developer
Evam Streaming Analytics

Atatürk Mah. Turgut Özal Bulv.
Gardenya 5 Plaza K:6 Ataşehir
34758 İSTANBUL

Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
www.evam.com.tr
<http://www.evam.com>