how to measure performance in hibernate? I want to know that how much time hibernate takes to execute a query?
相关问题
- Faster loop: foreach vs some (performance of jsper
- Why wrapping a function into a lambda potentially
- Ado.net performance:What does SNIReadSync do?
- Device support warning : Google play 2019
- How does the JPA handle partial, non-disjoint inhe
相关文章
- Hibernate Tutorial - Where to put Mapping File?
- Hibernate doesn't generate cascade
- Setup and Tear Down of Complex Database State With
- DOM penalty of using html attributes
- Which is faster, pointer access or reference acces
- Django is sooo slow? errno 32 broken pipe? dcramer
- Understanding the difference between Collection.is
- parallelizing matrix multiplication through thread
Do you mean literally the query or the query + the munging of the data into Java objects?
Either way, using a profiling tool such as JProbe is probably the way to go if you want to be scientific. You don't necesserily need to spend money, there are some free tools in Eclipse too.
In the simplest case, just adding a few print statements around the code in question can be enough, if the the thing you are measuring is the dominant processing.
Getting really thorough in performance analysis takes great care. Often you need to run many repeats of the thing you're testing in order to make sure you don't get mislead by initial overheads (such as opening the connection to the Db). And don't forget that the database and performance is likely to be critical, hibernate itself can't do anything about a badly tuned database.
When I do development with Spring Hibernate I usually use following properties
in my application.properties file to see query execution time and how query is executed:
Example log output looks like below:
JProfiler 7.1 has a JPA/Hibernate probe:
http://www.ej-technologies.com/products/jprofiler/whatsnew71.html
Here's a screen cast that shows how it works:
http://blog.ej-technologies.com/2012/01/profiling-jpahibernate.html
The hot spots view looks like this:
Disclaimer: My company develops JProfiler
I would recommend one or several of the following options: