arieljannai
arieljannai

Reputation: 2146

Why every DiskStorage flush in EhCache takes 4 seconds?

We are using EhCache 2.6.2. Because we need high survivability we use only DiskStorage and not MemoryStorage.

After every data update we have in the program, we flush the data to the disk.

After a while, the cache.data file exceeded max of 1 gb. When the data file was 250 mb, the flush took 250ms and when it's 1gb, it takes 3.5 sec.

Our objects are about 20kb each, so there are millions of them.

Is there a way to split the data file to few smaller files and let EhCache handle it?

We would prefer to have solution involving only configuration changes and not code change, cause it's in production environment.

Environment details:

Running WebSphere 7 with IBM Java 1.6 with EhCache 2.6.2 on AIX 6.1 64bit.

Upvotes: 0

Views: 274

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

In Ehcache 2.6.2 all cache data will always be on disk, as the storage model changed, so you could benefit from a speed-up by using memory storage in addition to the disk storage.

What do you mean when you say:

After every data update we have in the program, we flush the data to the disk.

Regarding the performance of the disk store, there is one option that you can try:

<cache diskAccessStripes="4" ...>
  ...
</cache>

where the diskAccessStripes attribute takes a power of two value. Try it first with small values and see if you gain anything. The exact effect of this attribute will depend on a lot of factors: hardware, operation system as well as usage patterns of your application.

Upvotes: 1

Related Questions