how to measure hibernate performance?

后端 未结 4 514
醉梦人生
醉梦人生 2021-01-05 00:38

how to measure performance in hibernate? I want to know that how much time hibernate takes to execute a query?

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 01:11

    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.

提交回复
热议问题