2011-06-21 137 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="," /> 
相關問題