Hi val,
Thank you again for your kind reply. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:/org/springframework/beans/factory/xml/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <import resource="/related-alarm-metadata.xml" /> <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> <property name="peerClassLoadingEnabled" value="false" /> <!-- <property name="gridName" value="rlam" /> --> <property name="networkTimeout" value="300000" /> <!-- Enable only some events and leave other ones disabled. --> <property name="includeEventTypes"> <list> <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED" /> <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED" /> <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED" /> </list> </property> <property name="communicationSpi"> <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"> <property name="slowClientQueueLimit" value="5000" /> </bean> </property> <!-- Configure internal thread pool. --> <property name="publicThreadPoolSize" value="64" /> <!-- Configure system thread pool. --> <property name="systemThreadPoolSize" value="32" /> <property name="cacheConfiguration"> <list> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="seqCache" /> <property name="atomicityMode" value="TRANSACTIONAL" /> <property name="cacheMode" value="REPLICATED" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="startSize" value="#{1 * 1024 * 1024}" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <!-- <property name="writeBehindEnabled" value="true" /> --> <property name="indexedTypes"> <array> <value>java.lang.String</value> <value>java.lang.Long</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="rlPreAmCache" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <!-- <property name="writeBehindEnabled" value="true" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.RelatedPreAlarmKey</value> <value>com.ffcs.oss.ignite.rlam.domain.RelatedPreAlarm</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="rlPreAmOrgCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.RelatedPreAlarmOrgKey</value> <value>com.ffcs.oss.ignite.rlam.domain.RelatedPreAlarmOrg</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="rlPreAmNewCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.RelatedPreNewAlarmKey</value> <value>com.ffcs.oss.ignite.rlam.domain.RelatedPreNewAlarm</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="rlamCache" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.RelatedAlarmKey</value> <value>com.ffcs.oss.ignite.rlam.domain.RelatedAlarm</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="rcRuleCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="TRANSACTIONAL" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="indexedTypes"> <array> <value>java.lang.Long</value> <value>com.ffcs.oss.ignite.rlam.domain.RcRule</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="cacheName" /> <property name="startSize" value="#{1* 1024 * 1024}" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="indexedTypes"> <array> <value>java.lang.Long</value> <value>com.ffcs.oss.ignite.rlam.domain.CacheNameVO</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="eqtLnkRlCache" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="memoryMode" value="OFFHEAP_TIERED" /> <property name="swapEnabled" value="true" /> <!-- <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.link.EqtLinkRelatedKey</value> <value>com.ffcs.oss.ignite.rlam.domain.link.EqtLinkRelated</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="eqtLnkRlCache_Temp" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="memoryMode" value="OFFHEAP_TIERED" /> <property name="swapEnabled" value="true" /> <!-- <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.link.EqtLinkRelatedKey</value> <value>com.ffcs.oss.ignite.rlam.domain.link.EqtLinkRelated</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="lLnkRlCache" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="memoryMode" value="OFFHEAP_TIERED" /> <property name="swapEnabled" value="true" /> <!-- <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.link.LinkLinkRelatedKey</value> <value>com.ffcs.oss.ignite.rlam.domain.link.LinkLinkRelated</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="lLnkRlCache_Temp" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="memoryMode" value="OFFHEAP_TIERED" /> <property name="swapEnabled" value="true" /> <!-- <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.link.LinkLinkRelatedKey</value> <value>com.ffcs.oss.ignite.rlam.domain.link.LinkLinkRelated</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="tpAppCache" /> <property name="startSize" value="#{1* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.TopoApplyOccasionKey</value> <value>com.ffcs.oss.ignite.rlam.domain.TopoApplyOccasion</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="codeCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="REPLICATED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.CodeKey</value> <value>com.ffcs.oss.ignite.rlam.domain.Code</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="codeCache_Temp" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.CodeKey</value> <value>com.ffcs.oss.ignite.rlam.domain.Code</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="cableCountCache" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="memoryMode" value="OFFHEAP_TIERED" /> <property name="swapEnabled" value="true" /> <!-- <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.OcablesectionInfoKey</value> <value>com.ffcs.oss.ignite.rlam.domain.OcablesectionInfo</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="cableCountCache_Temp" /> <property name="startSize" value="#{100* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="memoryMode" value="OFFHEAP_TIERED" /> <property name="swapEnabled" value="true" /> <!-- <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}" /> --> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.OcablesectionInfoKey</value> <value>com.ffcs.oss.ignite.rlam.domain.OcablesectionInfo</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="alarmCableCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.cable.AlarmCableSecKey</value> <value>com.ffcs.oss.ignite.rlam.domain.cable.AlarmCableSec</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="alarmCableOptCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.cable.AlarmCableOptKey</value> <value>com.ffcs.oss.ignite.rlam.domain.cable.AlarmCableOpt</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="alarmCableSecStatCache" /> <property name="startSize" value="#{50* 1024 * 1024}" /> <property name="atomicityMode" value="ATOMIC" /> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="cacheStoreFactory" ref="rlamPojoStoreFactory" /> <property name="readThrough" value="true" /> <property name="writeThrough" value="true" /> <property name="indexedTypes"> <array> <value>com.ffcs.oss.ignite.rlam.domain.cable.AlarmCableSecStatKey</value> <value>com.ffcs.oss.ignite.rlam.domain.cable.AlarmCableSecStat</value> </array> </property> </bean> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="alarmCableTmpCache" /> <property name="startSize" value="#{10* 1024 * 1024}" /> <!-- <property name="atomicityMode" value="ATOMIC" /> --> <property name="cacheMode" value="PARTITIONED" /> <property name="backups" value="1" /> <property name="indexedTypes"> <array> <value>java.lang.Integer</value> <value>com.ffcs.oss.ignite.rlam.vo.AlarmCableSecTmp</value> </array> </property> </bean> </list> </property> <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. --> <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="ackTimeout" value="10000" /> <property name="socketTimeout" value="30000" /> <property name="networkTimeout" value="30000" /> <property name="reconnectCount" value="10" /> <property name="maxMissedHeartbeats" value="10" /> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> <property name="addresses"> <list> <value>192.168.14.81:47500..47509</value> <value>192.168.14.85:47500..47509</value> <value>192.168.14.86:47500..47509</value> </list> </property> </bean> </property> </bean> </property> </bean> </beans> That's my full configuration including cache configuration. Following is my code about bucking up and destorying caches. DataLoaderRunnable.java public class DataLoaderRunnable implements IgniteRunnable{ private IgnitePublicService ignitePublicService; private CacheNameVO cacheNameVO; private String loadKey; private List<String> lstSql; public DataLoaderRunnable(IgnitePublicService ignitePublicService,CacheNameVO vo, String loadKey,List<String> lstSql){ this.cacheNameVO = vo; this.loadKey = loadKey; this.lstSql = lstSql; this.ignitePublicService = ignitePublicService; } @Override public void run() { try { DataLoaderTaskAdapter task = new DataLoaderTaskAdapter(ignitePublicService,cacheNameVO.value,loadKey,lstSql); int task_num = ignitePublicService.getIgnite().compute().execute(task,null); if(task_num == lstSql.size()){ LogPrint.LOADER_BASE_INFO_LOGGER.info("DataLoaderRunnable is End, CacheName:" + cacheNameVO.value); cacheNameVO.isLoadedData = true; IgniteCache<Long, Object> cacheForName = ignitePublicService.getIgnite().cache(CacheName.CACHE_NAME); cacheForName.put(cacheNameVO.id,cacheNameVO); Thread.sleep(1000L); //destory former cache IgniteCache<?, ?> cacheRemove = ignitePublicService.getCache(cacheNameVO.valueTemp); cacheRemove.destroy(); LogPrint.LOADER_BASE_INFO_LOGGER.info("DataLoaderRunnable destroy Temp Cache. CacheName:" + cacheNameVO.valueTemp); //create cache CacheConfiguration[] cacheCfgs = ignitePublicService.getIgnite().configuration().getCacheConfiguration(); for (CacheConfiguration cacheCfg : cacheCfgs) { if(cacheCfg.getName().equals(cacheNameVO.valueTemp)){ CacheConfiguration<?, ?> copy = new CacheConfiguration<>(cacheCfg); copy.setName(cacheNameVO.valueTemp); ignitePublicService.getIgnite().createCache(copy); } } LogPrint.LOADER_BASE_INFO_LOGGER.info("DataLoaderRunnable Create Temp Cache. CacheName:" + cacheNameVO.valueTemp); } } catch (Exception e) { LogPrint.ERROR_INFO_LOGGER.info("load entries:" + lstSql,e); } } } DataLoaderTaskAdapter.java public class DataLoaderTaskAdapter extends ComputeTaskAdapter<String, Integer>{ private List<String> lstSql; private String cacheName; private String loadKey; private IgnitePublicService ignitePublicService; public DataLoaderTaskAdapter(IgnitePublicService ignitePublicService,String cacheName,String loadKey,List<String> lstSql) { this.ignitePublicService = ignitePublicService; this.cacheName = cacheName; this.loadKey = loadKey; this.lstSql = lstSql; } @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, String arg1) throws IgniteException { Map<ComputeJob, ClusterNode> map = new HashMap<>(lstSql.size()); Iterator<ClusterNode> it = subgrid.iterator(); for (final String sql : lstSql) { if (!it.hasNext()) it = subgrid.iterator(); ClusterNode node = it.next(); map.put(new ComputeJobAdapter() { @Override public Object execute() { doLoadData(sql); return 1; } }, node); } return map; } @Override public Integer reduce(List<ComputeJobResult> results) throws IgniteException { int sum = 0; for (ComputeJobResult res : results) sum += res.<Integer>getData(); return sum; } private void doLoadData(String sql){ LogPrint.LOADER_BASE_INFO_LOGGER.info("DataLoaderTaskAdapter started ,cacheName:" + cacheName + ",sql:" + sql); IgniteCache<?, ?> cache = ignitePublicService.getCache(cacheName); long startTime = new Date().getTime(); cache.loadCache(null, loadKey, sql); LogPrint.LOADER_BASE_INFO_LOGGER.info("load cache use time:" + (new Date().getTime() - startTime) + "ms, size=" + cache.size()+",cacheName="+cacheName + ",sql:" + sql); } } By the way, does ignite proide an API to release off-heap memory? Is there an offHeapMaxMemory property which can rule all caches within an ignite instance instead of one cache in an ignite instance? -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cache-Problems-tp7477p7592.html