Java Ehcache集群在Tomcat上启动需要很长时间
我使用的是部署在Tomcat7环境中的复制ehcache。这里发生的事情是tomcat启动所需的时间太长,日志中充满了ehcache心跳消息 关于我们如何加速ehcache和Tomcat的启动,有什么想法吗 我的ehcache.xml-Java Ehcache集群在Tomcat上启动需要很长时间,java,tomcat,jakarta-ee,ehcache,Java,Tomcat,Jakarta Ee,Ehcache,我使用的是部署在Tomcat7环境中的复制ehcache。这里发生的事情是tomcat启动所需的时间太长,日志中充满了ehcache心跳消息 关于我们如何加速ehcache和Tomcat的启动,有什么想法吗 我的ehcache.xml- <?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:n
<?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>
您需要将引导程序策略更改为异步(
bootstrappasynchronously=true
),以避免启动过程中的延迟,即:
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
propertySeparator="," />
您需要将引导程序策略更改为异步(
bootstrappasynchronously=true
),以避免启动过程中的延迟,即:
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
propertySeparator="," />
你能发布你的ehcache配置示例吗?@Andrey Adamovich-更新原始问题。如何从缓存配置中删除引导加载程序?@Andrey Adamovich-如果删除引导加载程序,我会面临任何问题吗?tomcat启动时,你的缓存将为空;bootstrap只是尝试在启动时从其他正在运行的节点对其进行预填充。您可以发布您的ehcache配置示例吗?@Andrey Adamovich-更新原始问题。从缓存配置中删除bootstrap加载程序如何?@Andrey Adamovich-如果删除bootstrap加载程序,我会遇到任何问题吗?tomcat启动时,您的缓存将为空;引导只是尝试在启动时从其他正在运行的节点对其进行预填充