2

Ehcacheの構成に大きな問題があります。

私が使う:

  • ehcache 2.6.2
  • Hibernate 3.3.1 GA

私の現在の構成は次のとおりです。

1)休止状態

<bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> 
  <property name="properties">
    <props> 
       <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> 
       <prop key="hibernate.default_schema">@db.schema@</prop> 
       <prop key="hibernate.show_sql">false</prop> 
       <prop key="connection.pool_size">10</prop> 
       <prop key="hibernate.jdbc.batch_size">30</prop> 
       <prop key="hibernate.default_batch_fetch_size">30</prop> 
       <prop key="hibernate.max_fetch_depth">30</prop> 
       <prop key="hibernate.cache.use_second_level_cache">true</prop> 
       <prop key="hibernate.cache.use_query_cache">true</prop> 
       <prop key="hibernate.cache.region.factory_class"> 
          net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory 
       </prop> 
       <prop key="net.sf.ehcache.configurationResourceName"> 
         /ehcache-config.xml 
       </prop> 
       <prop key="hibernate.generate_statistics">true</prop> 
     </props> 
  </property> 
</bean> 

2)ehcache-config.xml

<ehcache name="xxxx"> 

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

<defaultCache 
  maxElementsInMemory="10000" 
  eternal="false" 
  timeToIdleSeconds="120" 
  timeToLiveSeconds="120" 
  overflowToDisk="true" 
  maxElementsOnDisk="10000000" 
  diskPersistent="false" 
  diskExpiryThreadIntervalSeconds="120" 
  memoryStoreEvictionPolicy="LRU" 
 /> 

 <cache name="org.hibernate.cache.UpdateTimestampsCache" 
   maxEntriesLocalHeap="5000" 
   eternal="true"> 
   <persistence strategy="localTempSwap"/> 
 </cache> 

 <cache name="org.hibernate.cache.StandardQueryCache" 
   maxElementsInMemory="10000" 
   eternal="false" 
   timeToIdleSeconds="120" 
   timeToLiveSeconds="120" 
   overflowToDisk="false" 
   diskExpiryThreadIntervalSeconds="120"> 
   <persistence strategy="localTempSwap"/> 
 </cache> 

 </ehcache> 

すべてのjavaオブジェクトはSerializableを実装し、読み取り/書き込みキャッシュを使用します。すべてのクエリはsetCacheable(true)ですが、それでもパフォーマンスの向上は見られません。

まず第一に、私はこのような多くのメッセージを持っています:

 19:30:51,829 DEBUG [Segment] fault added 0 on disk 
 19:30:51,829 DEBUG [Segment] put added 0 on heap 
 19:30:51,829 DEBUG [Segment] fault removed 0 from heap 
 19:30:51,829 DEBUG [Segment] fault added 0 on disk 
 19:30:51,829 DEBUG [Segment] put added 0 on heap 
 19:30:51,830 DEBUG [Segment] fault removed 0 from heap 
 19:30:51,830 DEBUG [Segment] fault added 0 on disk 

そして、私が気付いた最も重要なこと:キャッシュを使用するすべての試みは次のように終わります:

 1) 19:30:47,396 DEBUG [EhcacheGeneralDataRegion] Element for key sql: **** is null

 2) 20:26:31,939 DEBUG [EhcacheGeneralDataRegion] key: ****
    20:26:31,939 DEBUG [EhcacheGeneralDataRegion] Element for key **** is null 

ご協力いただきありがとうございます。

よろしくお願いします。

4

0 に答える 0