1

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) ?

3
  • It will depend on your application. I tend to use none of them and load the data in an external cache library like ehcache or infinispan. Commented May 7, 2014 at 20:38
  • @Luiggi Mendoza, Hibernate uses ehcache (one of possible variants) as external cache provider. Commented May 7, 2014 at 20:40
  • I know, still from my tests I don't trust it and use it as external component instead of using it next to hibernate. Commented May 7, 2014 at 20:41

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.