Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setStatisticsEnabled()
The following examples show how to use
org.apache.ignite.configuration.CacheConfiguration#setStatisticsEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterNodeMetricsSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(); cfg.setMetricsUpdateFrequency(500); CacheConfiguration<Integer, Object> ccfg = defaultCacheConfiguration(); ccfg.setName(CACHE_NAME); ccfg.setStatisticsEnabled(true); FifoEvictionPolicy plc = new FifoEvictionPolicy(); plc.setMaxMemorySize(MAX_VALS_AMOUNT * VAL_SIZE); plc.setMaxSize(0); ccfg.setEvictionPolicy(plc); ccfg.setOnheapCacheEnabled(true); return cfg.setCacheConfiguration(ccfg); }
Example 2
Source File: IgniteCacheLoadRebalanceEvictionSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); LruEvictionPolicy evictionPolicy = new LruEvictionPolicy<>(); evictionPolicy.setMaxSize(LRU_MAX_SIZE); CacheConfiguration<String, byte[]> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); cacheCfg.setCacheMode(CacheMode.PARTITIONED); cacheCfg.setBackups(1); cacheCfg.setReadFromBackup(true); cacheCfg.setEvictionPolicy(evictionPolicy); cacheCfg.setOnheapCacheEnabled(true); cacheCfg.setStatisticsEnabled(true); cacheCfg.setWriteThrough(false); cacheCfg.setReadThrough(false); cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new Storage())); cfg.setCacheConfiguration(cacheCfg); return cfg; }
Example 3
Source File: CacheAbstractQueryMetricsSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration<Integer, String> cacheCfg1 = defaultCacheConfiguration(); cacheCfg1.setName("A"); cacheCfg1.setCacheMode(cacheMode); cacheCfg1.setWriteSynchronizationMode(FULL_SYNC); cacheCfg1.setIndexedTypes(Integer.class, String.class); cacheCfg1.setStatisticsEnabled(true); CacheConfiguration<Integer, String> cacheCfg2 = defaultCacheConfiguration(); cacheCfg2.setName("B"); cacheCfg2.setCacheMode(cacheMode); cacheCfg2.setWriteSynchronizationMode(FULL_SYNC); cacheCfg2.setIndexedTypes(Integer.class, String.class); cacheCfg2.setStatisticsEnabled(true); cfg.setCacheConfiguration(cacheCfg1, cacheCfg2); return cfg; }
Example 4
Source File: DemoRandomCacheLoadService.java From ignite with Apache License 2.0 | 5 votes |
/** * Configure cacheCountry. */ private static <K, V> CacheConfiguration<K, V> cacheRandom() { CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(RANDOM_CACHE_NAME); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg.setQueryDetailMetricsSize(10); ccfg.setStatisticsEnabled(true); ccfg.setIndexedTypes(Integer.class, Integer.class); return ccfg; }
Example 5
Source File: GridCachePartitionedHitsAndMissesSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Cache configuration. * * @return Cache configuration. * @throws Exception In case of error. */ protected CacheConfiguration cacheConfiguration() throws Exception { CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setCacheMode(PARTITIONED); cfg.setWriteSynchronizationMode(FULL_ASYNC); cfg.setEvictionPolicy(null); cfg.setBackups(1); cfg.setNearConfiguration(null); cfg.setStatisticsEnabled(true); return cfg; }
Example 6
Source File: OffheapCacheMetricsForClusterGroupSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param cacheName Cache name. * @return Cache configuration. */ private static CacheConfiguration<Integer, Integer> cacheConfiguration(String cacheName) { CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>(cacheName); cfg.setBackups(1); cfg.setStatisticsEnabled(true); cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); return cfg; }
Example 7
Source File: CacheMetricsForClusterGroupSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param statisticsEnabled Statistics enabled. */ private void createCaches(boolean statisticsEnabled) { CacheConfiguration ccfg1 = defaultCacheConfiguration(); ccfg1.setName(CACHE1); ccfg1.setStatisticsEnabled(statisticsEnabled); CacheConfiguration ccfg2 = defaultCacheConfiguration(); ccfg2.setName(CACHE2); ccfg2.setStatisticsEnabled(statisticsEnabled); cache1 = grid(0).getOrCreateCache(ccfg1); cache2 = grid(0).getOrCreateCache(ccfg2); }
Example 8
Source File: CacheGetsDistributionAbstractTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @return Cache configuration. */ protected <K, V> CacheConfiguration<K, V> cacheConfiguration() { CacheConfiguration<K, V> ccfg = defaultCacheConfiguration(); ccfg.setCacheMode(cacheMode()); ccfg.setAtomicityMode(atomicityMode()); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setReadFromBackup(true); ccfg.setStatisticsEnabled(true); if (cacheMode() == CacheMode.PARTITIONED) ccfg.setBackups(backupsCount()); return ccfg; }
Example 9
Source File: DemoCachesLoadService.java From ignite with Apache License 2.0 | 5 votes |
/** * Create base cache configuration. * * @param name cache name. * @return Cache configuration with basic properties set. */ private static CacheConfiguration cacheConfiguration(String name) { CacheConfiguration ccfg = new CacheConfiguration<>(name); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg.setQueryDetailMetricsSize(10); ccfg.setStatisticsEnabled(true); ccfg.setSqlFunctionClasses(SQLFunctions.class); ccfg.setDataRegionName("demo"); return ccfg; }
Example 10
Source File: RestBinaryProtocolSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param cacheName Cache name. * @return Cache configuration. * @throws Exception In case of error. */ private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception { CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setCacheMode(LOCAL); cfg.setName(cacheName); cfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setStatisticsEnabled(true); return cfg; }
Example 11
Source File: RestMemcacheProtocolSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param cacheName Cache name. * @return Cache configuration. * @throws Exception In case of error. */ private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception { CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setCacheMode(LOCAL); cfg.setName(cacheName); cfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setStatisticsEnabled(true); return cfg; }
Example 12
Source File: CacheOperationsWithExpirationTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param atomicityMode Atomicity mode. * @param idx Indexing enabled flag. * @return Cache configuration. */ private CacheConfiguration<String, TestIndexedType> cacheConfiguration(CacheAtomicityMode atomicityMode, boolean idx) { CacheConfiguration<String, TestIndexedType> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); ccfg.setAtomicityMode(atomicityMode); ccfg.setBackups(1); ccfg.setWriteSynchronizationMode(PRIMARY_SYNC); ccfg.setStatisticsEnabled(true); if (idx) ccfg.setIndexedTypes(String.class, TestIndexedType.class); return ccfg; }
Example 13
Source File: CacheAbstractQueryDetailMetricsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param cacheName Cache name. * @return Cache configuration. */ private CacheConfiguration<Integer, String> configureCache(String cacheName) { CacheConfiguration<Integer, String> ccfg = defaultCacheConfiguration(); ccfg.setName(cacheName); ccfg.setCacheMode(cacheMode); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setIndexedTypes(Integer.class, String.class); ccfg.setStatisticsEnabled(true); ccfg.setQueryDetailMetricsSize(QRY_DETAIL_METRICS_SIZE); return ccfg; }
Example 14
Source File: GridCacheAbstractMetricsSelfTest.java From ignite with Apache License 2.0 | 4 votes |
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { CacheConfiguration configuration = super.cacheConfiguration(igniteInstanceName); configuration.setStatisticsEnabled(true); return configuration; }
Example 15
Source File: HibernateL2CacheSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @param regionName Region name. * @return Transactional Cache configuration */ protected CacheConfiguration transactionalRegionConfiguration(String regionName) { CacheConfiguration cfg = new CacheConfiguration(); cfg.setName(regionName); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(TRANSACTIONAL); cfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setBackups(1); cfg.setStatisticsEnabled(true); cfg.setAffinity(new RendezvousAffinityFunction(false, 10)); return cfg; }
Example 16
Source File: HibernateL2CacheSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @param regionName Region name. * @return Cache configuration for {@link IgniteGeneralDataRegion}. */ private CacheConfiguration generalRegionConfiguration(String regionName) { CacheConfiguration cfg = new CacheConfiguration(); cfg.setName(regionName); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(ATOMIC); cfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setBackups(1); cfg.setStatisticsEnabled(true); //cfg.setAffinity(new RendezvousAffinityFunction(false, 10)); return cfg; }
Example 17
Source File: CacheMetricsManageTest.java From ignite with Apache License 2.0 | 4 votes |
/** * */ @Test public void testPublicApiStatisticsEnable() throws Exception { Ignite ig1 = startGrid(1); startGrid(2); IgniteCache<Object, Object> cache1 = ig1.cache(CACHE1); CacheConfiguration<Object, Object> cacheCfg2 = new CacheConfiguration<Object, Object>(cache1.getConfiguration(CacheConfiguration.class)); cacheCfg2.setName(CACHE2); cacheCfg2.setStatisticsEnabled(true); ig1.getOrCreateCache(cacheCfg2); assertCachesStatisticsMode(false, true); cache1.enableStatistics(true); assertCachesStatisticsMode(true, true); ig1.cluster().enableStatistics(Arrays.asList(CACHE1, CACHE2), false); assertCachesStatisticsMode(false, false); }
Example 18
Source File: HibernateL2CacheConfigurationSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** * @param cacheName Cache name. * @return Cache configuration. */ private CacheConfiguration cacheConfiguration(String cacheName) { CacheConfiguration cfg = new CacheConfiguration(); cfg.setName(cacheName); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(ATOMIC); cfg.setStatisticsEnabled(true); return cfg; }