Question

Caching is all about application performance optimization and it sits between your application and the database to avoid the number of database hits as many as possible to give a better performance for performance critical applications.

I have ability to use Hibernate cache and MySql query cache.

What mechanism should i choose ? Or may be i should use both of them to rich maximum performance (and maximum RAM usage :D) ?

Was it helpful?

Solution

We have two ways of Cache in Hibernate.

1) Memory (RAM)

2) Disk (HD)

Since you are trying to save the RAM, please try to create the cache in the disk.

Use the DiskStore option in the EnCache.

<cache>
   <persistence strategy=”localRestartable|localTempSwap|none|distributed” synchronousWrites=”false|true”/>
</cache>

If you are using Java 7 and plus.

Go for BigMemory for the best performance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top