ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sajal Gupta <sajal.gupta2...@gmail.com>
Subject Optimistic transaction very slow on v1.3.2 community edition
Date Wed, 29 Jul 2015 11:07:29 GMT
Trying the below sample where I am putting 20000 entries in cache within
transaction on a single node(JRE 7, heap 4GB),it takes more than 20sec to
commit. The thread dumps below shows thread executing
GridCacheMvccManager.addNext most of the time.The same sample with
pessimistic mode takes less than 5sec
Let me know if there is any other setting that should be specified or is it
the best we can get considering everything is happening in memory on single
node?
       URL url =
TestCache.class.getResource("/unittest/gridgain/example-ignite.xml");
         Ignite ignite = Ignition.start(url);
         System.out.println();
         System.out.println(">>> Cache API example started.");

         CacheConfiguration cfg = new CacheConfiguration();
         cfg.setName("myCache");
         cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
         cfg.setCacheMode(CacheMode.PARTITIONED);
         cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
         cfg.setRebalanceMode(CacheRebalanceMode.ASYNC);

cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC);
         cfg.setOffHeapMaxMemory(2 * 1024L * 1024L * 1024L);
         IgniteCache<String,byte[]> cache = ignite.createCache(cfg);
         byte[] valArr = new byte[16000];
         for(int i=0;i<valArr.length;i++){
          valArr[i] = 0x0;
         }
         long t1 = System.currentTimeMillis();
         try (Transaction tx =
(Transaction)Ignition.ignite().transactions().txStart(TransactionConcurrency.OPTIMISTIC,TransactionIsolation.REPEATABLE_READ)){
          for(int i=0;i<20000;i++){
           cache.put("K"+(long)i,valArr);
          }
          tx.commit();
         }
         long t2 = System.currentTimeMillis();
         System.out.println("Time taken:"  + (t2-t1));


"main" prio=6 tid=0x0000000002c33800 nid=0x454 runnable [0x0000000002b4e000]
   java.lang.Thread.State: RUNNABLE
 at java.util.LinkedList.add(LinkedList.java:336)
 at
org.apache.ignite.internal.processors.cache.GridCacheMvccManager.addNext(GridCacheMvccManager.java:733)
 at
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry.addDhtLocal(GridDhtCacheEntry.java:230)
 at
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry.tmLock(GridDhtCacheEntry.java:244)
 at
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager.lockMultiple(IgniteTxManager.java:1586)
 at
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager.prepareTx(IgniteTxManager.java:882)
 at
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter.userPrepare(IgniteTxLocalAdapter.java:410)
 at
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.prepareAsyncLocal(GridNearTxLocal.java:852)

Mime
View raw message