You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Igor Belyakov (JIRA)" <ji...@apache.org> on 2019/04/09 09:09:00 UTC

[jira] [Assigned] (IGNITE-11695) AverageGetTime metric doesn't work properly with ScanQuery predicate

     [ https://issues.apache.org/jira/browse/IGNITE-11695?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Belyakov reassigned IGNITE-11695:
--------------------------------------

    Assignee: Igor Belyakov

> AverageGetTime metric doesn't work properly with ScanQuery predicate
> --------------------------------------------------------------------
>
>                 Key: IGNITE-11695
>                 URL: https://issues.apache.org/jira/browse/IGNITE-11695
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Evgenii Zhuravlev
>            Assignee: Igor Belyakov
>            Priority: Major
>              Labels: newbie
>
> In *GridCacheQueryManager.advance* method *start* variable is set only once, at the start of executing the method, while metrics.onRead inside this method could be executed multiple times in case if Predicate returns false. In the case of using FILTER_COUNT= 100000, there will be CacheGets=100000 and very big value for AverageGetTime. If it will be changed to 1, CacheGets still will be equal to 100000, while AverageGetTime will be really small.
> Reproducer:
> {code:java}
> public class ExampleNodeStartup {
>     private static int FILTER_COUNT = 100000;
>     /**
>      * Start up an empty node with example compute configuration.
>      *
>      * @param args Command line arguments, none required.
>      * @throws IgniteException If failed.
>      */
>     public static void main(String[] args) throws IgniteException {
>         Ignite ignite = Ignition.start();
>         IgniteCache cache = ignite.getOrCreateCache(new CacheConfiguration<>("test").setStatisticsEnabled(true));
>         for (int i = 0; i < 100000; i++)
>             cache.put(i, i);
>         long start = System.currentTimeMillis();
>         Iterator it = cache.query(new ScanQuery().setFilter(new IgniteBiPredicate() {
>             @Override public boolean apply(Object o, Object o2) {
>                 if ((int)o2 % FILTER_COUNT == 0)
>                     return true;
>                 return false;
>             }
>         })).iterator();
>         while (it.hasNext())
>             System.out.println("iterator value: " + it.next());
>         System.out.println("Execution time: " + (System.currentTimeMillis() - start));
>         System.out.println("GETS: " + cache.metrics().getCacheGets());
>         System.out.println("GET times: " + cache.metrics().getAverageGetTime());
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)