I guess updating indexes is not free. Sergi
On Mon, Jul 11, 2016 at 11:48 PM, AndreyVel <andrey4...@gmail.com> wrote: > Hello, I have created simple test for testing performance put operations > on single computer, > can anybody explain why performance for LOCAL mode different for Indexed > and non Indexed mode? > > > Cache performance put(Integer, String)/sec: one client and 2 > remote servers. > > CacheMode TRANSACTIONAL TRANSACTIONAL > setIndexedTypes(Integer, String) ATOMIC ATOMIC > setIndexedTypes(Integer, String) > LOCAL 45154 107306 340627 581250 > REPLICATED 3270 2865 7272 5694 > PARTITIONED 6773 5403 8558 6714 > > > VM options -Xms1g -Xmx1g > Topology snapshot [ver=5, servers=2, clients=1, CPUs=8, heap=3.0GB] > > > public class CachePerformance { > > private static int CACHE_SIZE =100 * 1000; > private static StringCACHE_NAME ="cachePerf"; > > public static void main(String[] args) { > try { > Ignition.setClientMode(true); > IgniteConfiguration igniteCfg =new IgniteConfiguration(); > igniteCfg.setPeerClassLoadingEnabled(true); > > Ignite ignite = Ignition.start(igniteCfg); > CachePerformance.execute(ignite); > }catch (Throwable ex) { > ex.printStackTrace(); > } > } > > public static void execute(Ignite ignite)throws Exception { > > Random rand =new Random(); > > for (CacheMode cacheMode : CacheMode.values()) { > > for (CacheAtomicityMode atomMode : CacheAtomicityMode.values()) { > for (int indexMode =0; indexMode <=1; indexMode++) { > > CacheConfiguration<Integer, String> cacheCfg =new > CacheConfiguration<>(CACHE_NAME); > if (indexMode ==1) > cacheCfg.setIndexedTypes(Integer.class, String.class); > > cacheCfg.setAtomicityMode(atomMode); > cacheCfg.setCacheMode(cacheMode); > > ignite.destroyCache(CACHE_NAME); > IgniteCache<Integer, String> cache = > ignite.getOrCreateCache(cacheCfg); > String cacheDesc ="cacheMode=" + cacheMode +", atomMode=" > + atomMode +", indexMode=" + indexMode; > > long time = System.nanoTime(); > for (int ind =0; ind <CACHE_SIZE; ind++) { > Integer key = rand.nextInt(); > cache.put(key,"=" + ind); > } > > long deltaMs = (System.nanoTime() - time) /1000000; > long perfSec = (deltaMs ==0) ?0 :1000 *CACHE_SIZE / > deltaMs; > System.out.println(cacheDesc +", Perf/Sec = " + perfSec); > } > } > } >