In Java world most of the developer have use Hibernate as ORM Framework in their applications development and most of them have encountering the performance issues. The beauty is most of the time performance issues are visible when application push to production.

According to my experience most of the performance drops are often related to slow database query at that time we need to find which queries causes the problem ? šŸ˜Ÿ

Don’t worry there is a easy way to find that issue. In hibernate can be configure to collect statistics and provide statistics to analyze database query issues.

Let’s see how we can do it.

Step 1. Enable hibernate.generate_statistics

properties.put(“hibernate.generate_statistics”, true);

state enable

Step 2. Hibernate Logs enable and set level to debug (This is not required)

logconfig

After these two steps you can run your code and refer the console logs for access the hibernate session statics. In there I’m used sample application for save 3 employee object and retrieve all employee from database.

app

Step 3. Access logs to read hibernate statics details.

console

Summary

In java applications to find performance issues, we can use hibernate statistics this configuration we can use development stage to identify the hibernate performance issue. Based on that we can
easily identify the application issues in which sections.

Hope this article helps to identify your application hibernate performance issue.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s