• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some questions about performance of Java Persistence

 
Mark Connell
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Do you still see hibernate as the best leading Java Persistence for object relational mapping in terms of performance?
2. Has their been any changes based on your research that developers should think of in term's of performance ? Typically I think caching mechanism such as ehcache or front side caching like redis is still the go to for performance enhancement.
3. Can you explain the difference between the different level's of caching in Hibernate and do you find any other framework's do it better?

Cheers
 
Vlad Mihalcea
Author
Ranch Hand
Posts: 32
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. It's very difficult to define what is "best". It is the most widespread one, and that was a very compelling reason for dedicating the second part to Hibernate.
2. Front-side caching is definitely very important, but there are still a lot of things you can do to optimize response time: batching, statement caching, watching executed queries to make sure they are efficient, indexing properly, fetching less data than necessary.
3. The first-level cache is a transactional write-behind cache that gives you application-level repeatable reads. It's bound to a Session so it's not thread-safe. Its purpose is to delay the connection acquisition and to allow you to batch statements automatically. The 2nd level cache is thread-safe and you can even use a cluster cache with off-heap storage (Terracotta, Hazelcast). The 2nd level cache can help you to reduce the load on the database, and it is strongly consistent (a data integrity guarantee that is much harder to enforce on other caching solutions).
 
Mark Connell
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

When would you typically do front side caching and cluster off heap caching usage? Look forward to reading your book. Do you go into detail with example in your both those types of caching mechanism's?

 
Vlad Mihalcea
Author
Ranch Hand
Posts: 32
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, I would never deploy an enterprise project into production unless I have a caching solution that allows me to switch to a read-only mode.
This is invaluable for times when something goes terribly wrong with the system.
So, a front-side cache can really help offer this functionality. As long as you protect against data integrity issues, a caching solution can be a safety hook anyway.

I'm now about to finish the Fetching chapter, and the next one is about Caching. I'll discuss more on 2nd level cache because the second part is focused on Hibernate.
Nevertheless, I'll talk about what read-through, write-though, write-behind means, how read-only, read-write, transactional caches work and how the nonstrict-read-write can compromise integrity.
I'll talk about collection cache and query cache and the read-only reference optimization.

All in all, if you consider buying this book, I'm sure you are going to find a lot of things that can help you deliver a high-performance data access layer.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic