The Easiest Way to Find and Fix Hibernate Performance Problems

Automatically detect relevant Hibernate performance issues and get project-specific information on how to fix them.

Finding and Fixing Hibernate Performance Issues Has Never Been Easier

Too many Hibernate performance issues show up in production because they are hard to find in a typical test environment. You either need a huge test database and run hundreds of tests in parallel, or you need to have very detailed information about how Hibernate interacts with your database.


PerfTester collects these information, makes them testable, uses them to detect relevant performance issues automatically and provides you with detailed suggestions to fix them. Instead of fixing every theoretical performance issue, PerfTester identifies the important 20% of the changes that will provide you 80% of the performance improvements.

Detect Hibernate Performance Problems Automatically

Experience and static code analysis can show you which part of your code could create a performance issue. But you can only guess if these theoretical problems have an actual impact on the performance of your application.

Stop guessing and analyze what's actually happening in your code!

PerfTester automatically collects important statistics during your test run and analyzes them to find typical performance issues. If it finds any problem, it presents it to you with detailed information about where it occurs and what you can do to fix it.

Example: PerfTester Detected an N+1 Select Issue

[N_PLUS_ONE] Potential n+1 select issue detected for association com.thorben.janssen.app.spring.nPlusOne.entity.Author.books. You fetch it for 100% of the loaded com.thorben.janssen.app.spring.nPlusOne.entity.Author.

You should use a JOIN FETCH or an EntityGraph to initialize the association. Learn more at: https://thorben-janssen.com/5-ways-to-initialize-lazy-relations-and-when-to-use-them/

Please review the following places in which you load com.thorben.janssen.app.spring.nPlusOne.entity.Author.books associations:
Query: LoadInfo [query=Initialize association com.thorben.janssen.app.spring.nPlusOne.entity.Author.books, executionPoint=com.thorben.janssen.app.spring.nPlusOne.SpringNPlusOneWarningTestExamples.fail_ManyToMany_lazyAccess_failOnWarning(SpringNPlusOneWarningTestExamples.java:65)]

These are fetched for com.thorben.janssen.app.spring.nPlusOne.entity.Author entities with ids: 1, 2, 3, 4

You load these entities at:
LoadInfo [query=select generatedAlias0 from Author as generatedAlias0, executionPoint=com.thorben.janssen.app.spring.nPlusOne.SpringNPlusOneWarningTestExamples.fail_ManyToMany_lazyAccess_failOnWarning(SpringNPlusOneWarningTestExamples.java:63)]

 

Make Your DB Interactions Testable

A small change in your code can force Hibernate to process your queries and API calls differently. This often drastically changes the number and types of SQL statements Hibernate executes.


To make these operations testable, PerfTester monitors Hibernate's operations and integrates with JUnit 5.  Within your tests, you can add an annotation or use PerfTester's API to implement an assertion to check the number and type of operations Hibernate performs and how much time it spends on them.

Example: Annotation-based Assertion of the Number of Excuted Statements

Example: API-based Assertion of the Number of Excuted Statements

Get Tips to Solve Common Exceptions

When Hibernate throws one of its typicaly exceptions, most developers search on StackOverflow for the best way to fix it. That takes time and you never know if the suggested change fixes your problem or just replaces it with a different one.


PerfTester solves this problem by analyzing the exception during the test run and providing proven resources that show you the best way to fix it.

Example: MultipleBagFetchException

Your test threw a MultipleBagFetchException. Here are a few suggestions on how to fix it: https://thorben-janssen.com/fix-multiplebagfetchexception-hibernate/

Get PerfTester Now!

Stop struggling with Hibernate performance issues. PerfTester detects the most common Hibernate performance issues and provides you project-specific information on how to fix them.

Single Developer License

79€ 49€ per year
(plus taxes)

20 Developer Team License

1.580€ 899€ per year
(plus taxes)

About the author

Hi,

I'm Thorben Janssen

I'm an independent consultant, international speaker, and trainer specialized in solving Java persistence problems with JPA and Hibernate. I'm also the author of Amazon’s bestselling book Hibernate Tips - More than 70 solutions to common Hibernate problems.

For the last few years, I have helped teams identify and fix Hibernate performance problems in their projects. Most often, these projects contain several potential problems but only a few of them cause 80% of the performance issues. Finding and solving them is the most efficient and easiest way to speed-up an application.

I've put all that experience into the development of PerfTester. It automates a huge part of the checks and analysis I use in my consulting projects and explains your options to fix the detected problems.