2011-06-21 143 views
0

我正在使用在Tomcat 7环境中部署的复制ehcache。这里发生的事情是,tomcat花费很长时间才能启动日志,并使ehcache心跳消息充满。Ehcache集群需要很长时间才能在Tomcat上启动

有关如何加速ehcache和Tomcat启动的想法?

我ehcache.xml中 -

<?xml version="1.0" encoding="UTF-8"?> 

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:noNamespaceSchemaLocation="ehcache.xsd" 
     updateCheck="true" monitoring="autodetect" 
     dynamicConfig="true"> 

    <diskStore path="java.io.tmpdir"/> 

    <transactionManagerLookup class="net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup" 
           properties="jndiName=java:/TransactionManager" propertySeparator=";"/> 
    <cacheManagerEventListenerFactory class="com.adobe_services.cache.SampleCacheManagerEventListenerFactory" properties="type=counting"/> 
    <cacheManagerPeerProviderFactory 
      class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" 
      properties="peerDiscovery=automatic, 
         multicastGroupAddress=230.0.0.1, 
         multicastGroupPort=4446, timeToLive=1" 
      propertySeparator="," 
      /> 
    <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" 
            properties="hostName=, port=, socketTimeoutMillis="/> 
    <defaultCache 
      maxElementsInMemory="10000" 
      eternal="false" 
      timeToIdleSeconds="120" 
      timeToLiveSeconds="120" 
      overflowToDisk="true" 
      diskSpoolBufferSizeMB="30" 
      maxElementsOnDisk="10000000" 
      diskPersistent="false" 
      diskExpiryThreadIntervalSeconds="120" 
      memoryStoreEvictionPolicy="LRU" 
      statistics="false" 
      /> 

    <cache name="replicatedCache" 
    maxElementsInMemory="5" 
      maxElementsOnDisk="100000" 
      eternal="true" 
      overflowToDisk="true" 
      diskPersistent="true" 
      diskSpoolBufferSizeMB="20" 
      timeToIdleSeconds="3600" 
      timeToLiveSeconds="3600" 
      memoryStoreEvictionPolicy="LFU" 
      transactionalMode="off"> 
     <cacheEventListenerFactory 
       class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/> 
     <bootstrapCacheLoaderFactory 
     class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" 
     properties="bootstrapAsynchronously=false, maximumChunkSizeBytes=5000000" 
     propertySeparator="," /> 
    </cache> 

    <cache name="replicatedCache2" 
    maxElementsInMemory="5" 
      maxElementsOnDisk="100000" 
      eternal="true" 
      overflowToDisk="true" 
      diskPersistent="true" 
      diskSpoolBufferSizeMB="20" 
      timeToIdleSeconds="3600" 
      timeToLiveSeconds="3600" 
      memoryStoreEvictionPolicy="LFU" 
      transactionalMode="off"> 
     <cacheEventListenerFactory 
       class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/> 
     <bootstrapCacheLoaderFactory 
     class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" 
     properties="bootstrapAsynchronously=false, maximumChunkSizeBytes=5000000" 
     propertySeparator="," /> 
    </cache> 


</ehcache> 
+0

您可以发布您的Ehcache配置的例子吗? –

+0

@Andrey Adamovich - 更新原始问题。 – Pushkar

+1

如何从缓存配置中删除引导加载程序? –

回答

3

您需要更改引导程序的策略是异步的(bootstrapAsynchronously=true),以避免启动过程中出现延迟即:

<bootstrapCacheLoaderFactory 
     class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" 
     properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000" 
     propertySeparator="," /> 
相关问题