我试图使用Ehcache写后缓存来将批处理事务写入我的数据库。我需要的是后写缓存以5秒的时间间隔(或更频繁)转储事务。Ehcache写后缓存线程优先
我必须错过一些东西,因为尽可能地尝试,它就是行不通的。我设置了后写缓存,然后将加载到服务器上。成千上万,然后几十万的交易,等待几分钟后,数据库中仍然没有任何东西。直到我关闭服务器上的负载后,缓存才开始写入数据库。
这是线程优先级的问题吗?有没有办法修改Ehcache来执行数据库写入,即使服务器处于负载下?
这里是我的配置:
<cache name="server.db.model.Request"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="5"
timeToLiveSeconds="5"
overflowToDisk="false"
memoryStoreEvictionPolicy="FIFO">
<cacheWriter writeMode="write_behind" maxWriteDelay="5" rateLimitPerSecond="5"
writeCoalescing="true" writeBatching="true" writeBatchSize="5000"
retryAttempts="2" retryAttemptDelaySeconds="10">
<cacheWriterFactory class="server.db.util.RequestCacheWriterFactory"/>
</cacheWriter>
</cache>
感谢。
这是在Linux/Tomcat环境中。我们没有明确地设置线程优先级。通过关闭负载,我的意思是我关闭了我用来击中服务器的jMeter线程。最后,根据这里的ehcache文档,我们使用hibernate:http://ehcache.org/documentation/hibernate.html。奇怪的是,即使我关闭了服务器上的负载之后,在开始写入数据库之前,我还得等5分钟左右。谢谢你的帮助。 – Tinclon 2011-02-09 16:47:23