Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to Profilling HQL?.. (Good Understanding)

 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers..

is there any good way to count the estimate time which needed to run a HQL?..
in my application now..
i count the time needed to execute HQL with JUnit..
my code is like the following code :


is this a good idea?..
is there any another way?..
Thanks in advance..
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leonardo,

I think this kind of "profiling" test won't give you reliable results. If you run this test against a real database backend there will be many caching effects (database, JPA, file system, OS) and something like this which could lead to very varying results from test run to test run and of course database server to database server.

I'm not an expert in performance testing databases but I guess it would be more appropriate to do some kind of stress test or performance tests which runs this test multiple times and maybe concurrently with multiple connections. But then of course this definitely isn't a good unit test anymore. You should probably move it to a separate test suite for such tests. Unfortunately the absolute estimated time for these queries still depends on the performance of your test client machine and your database server and DBMS but it's still better than running this test only one with your other unit tests.

Perhaps I should mention that you probably shouldn't worry too much about this fine tuning except this part is really a performance bottleneck for your application

Marco
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic